Lines Matching refs:unitp

148 	struct lm75_unit *unitp;  in lm75_open()  local
158 unitp = (struct lm75_unit *) in lm75_open()
161 if (unitp == NULL) { in lm75_open()
169 mutex_enter(&unitp->lm75_mutex); in lm75_open()
172 if (unitp->lm75_oflag != 0) { in lm75_open()
175 unitp->lm75_oflag = FEXCL; in lm75_open()
178 if (unitp->lm75_oflag == FEXCL) { in lm75_open()
181 unitp->lm75_oflag = FOPEN; in lm75_open()
185 mutex_exit(&unitp->lm75_mutex); in lm75_open()
195 struct lm75_unit *unitp; in lm75_close() local
204 unitp = (struct lm75_unit *) in lm75_close()
207 if (unitp == NULL) { in lm75_close()
211 mutex_enter(&unitp->lm75_mutex); in lm75_close()
213 unitp->lm75_oflag = 0; in lm75_close()
215 mutex_exit(&unitp->lm75_mutex); in lm75_close()
220 lm75_get16(intptr_t arg, int reg, struct lm75_unit *unitp, int mode) in lm75_get16() argument
227 (void) i2c_transfer_alloc(unitp->lm75_hdl, &i2c_tran_pointer, in lm75_get16()
231 "i2c_tran_pointer not allocated\n", unitp->lm75_name)); in lm75_get16()
238 err = i2c_transfer(unitp->lm75_hdl, i2c_tran_pointer); in lm75_get16()
241 "i2c_transfer routine\n", unitp->lm75_name)); in lm75_get16()
242 i2c_transfer_free(unitp->lm75_hdl, i2c_tran_pointer); in lm75_get16()
247 unitp->lm75_name, i2c_tran_pointer->i2c_rbuf[0], in lm75_get16()
265 "ddi_copyout routine\n", unitp->lm75_name)); in lm75_get16()
268 i2c_transfer_free(unitp->lm75_hdl, i2c_tran_pointer); in lm75_get16()
273 lm75_set16(intptr_t arg, int reg, struct lm75_unit *unitp, int mode) in lm75_set16() argument
282 "ddi_copyin routine\n", unitp->lm75_name)); in lm75_set16()
286 (void) i2c_transfer_alloc(unitp->lm75_hdl, &i2c_tran_pointer, in lm75_set16()
290 "i2c_tran_pointer not allocated\n", unitp->lm75_name)); in lm75_set16()
309 err = i2c_transfer(unitp->lm75_hdl, i2c_tran_pointer); in lm75_set16()
310 i2c_transfer_free(unitp->lm75_hdl, i2c_tran_pointer); in lm75_set16()
320 struct lm75_unit *unitp; in lm75_ioctl() local
333 unitp = (struct lm75_unit *) in lm75_ioctl()
336 if (unitp == NULL) { in lm75_ioctl()
342 mutex_enter(&unitp->lm75_mutex); in lm75_ioctl()
346 err = lm75_get16(arg, LM75_TEMPERATURE_REG, unitp, mode); in lm75_ioctl()
350 err = lm75_get16(arg, LM75_HYST_REG, unitp, mode); in lm75_ioctl()
354 err = lm75_set16(arg, LM75_HYST_REG, unitp, mode); in lm75_ioctl()
358 err = lm75_get16(arg, LM75_OVERTEMP_REG, unitp, mode); in lm75_ioctl()
362 err = lm75_set16(arg, LM75_OVERTEMP_REG, unitp, mode); in lm75_ioctl()
366 (void) i2c_transfer_alloc(unitp->lm75_hdl, &i2c_tran_pointer, in lm75_ioctl()
371 unitp->lm75_name)); in lm75_ioctl()
378 err = i2c_transfer(unitp->lm75_hdl, i2c_tran_pointer); in lm75_ioctl()
382 unitp->lm75_name)); in lm75_ioctl()
383 i2c_transfer_free(unitp->lm75_hdl, i2c_tran_pointer); in lm75_ioctl()
391 unitp->lm75_name)); in lm75_ioctl()
394 i2c_transfer_free(unitp->lm75_hdl, i2c_tran_pointer); in lm75_ioctl()
402 unitp->lm75_name)); in lm75_ioctl()
406 (void) i2c_transfer_alloc(unitp->lm75_hdl, &i2c_tran_pointer, in lm75_ioctl()
411 unitp->lm75_name)); in lm75_ioctl()
419 err = i2c_transfer(unitp->lm75_hdl, i2c_tran_pointer); in lm75_ioctl()
420 i2c_transfer_free(unitp->lm75_hdl, i2c_tran_pointer); in lm75_ioctl()
425 unitp->lm75_name, cmd)); in lm75_ioctl()
429 mutex_exit(&unitp->lm75_mutex); in lm75_ioctl()
462 struct lm75_unit *unitp; in lm75_do_attach() local
473 unitp = ddi_get_soft_state(lm75soft_statep, instance); in lm75_do_attach()
475 if (unitp == NULL) { in lm75_do_attach()
480 (void) snprintf(unitp->lm75_name, sizeof (unitp->lm75_name), in lm75_do_attach()
486 "%s\n", unitp->lm75_name, "lm75"); in lm75_do_attach()
492 if (i2c_client_register(dip, &unitp->lm75_hdl) != I2C_SUCCESS) { in lm75_do_attach()
499 mutex_init(&unitp->lm75_mutex, NULL, MUTEX_DRIVER, NULL); in lm75_do_attach()
523 struct lm75_unit *unitp; in lm75_do_detach() local
528 unitp = ddi_get_soft_state(lm75soft_statep, instance); in lm75_do_detach()
530 if (unitp == NULL) { in lm75_do_detach()
535 i2c_client_unregister(unitp->lm75_hdl); in lm75_do_detach()
539 mutex_destroy(&unitp->lm75_mutex); in lm75_do_detach()