/* returns 0 for success or < 0 for error  */
int ipath_tempsense_write(struct ipath_devdata *dd, u8 regnum, u8 data)
/* returns 0 for success or < 0 for error  */
int ipath_tempsense_write(struct ipath_devdata *dd, u8 regnum, u8 data)
{
	int ret;
	if (regnum > 15 || !((1 << regnum) & VALID_TS_WR_REG_MASK))
		return -EINVAL;
	ret = mutex_lock_interruptible(&dd->ipath_eep_lock);
	if (!ret) {
		ret = ipath_tempsense_internal_write(dd, regnum, data);
		mutex_unlock(&dd->ipath_eep_lock);
	}
	return ret;
}