Lines Matching refs:unitp
148 struct ltc1427_unit *unitp; in ltc1427_open() local
158 unitp = (struct ltc1427_unit *) in ltc1427_open()
161 if (unitp == NULL) { in ltc1427_open()
169 mutex_enter(&unitp->ltc1427_mutex); in ltc1427_open()
172 if (unitp->ltc1427_oflag != 0) { in ltc1427_open()
175 unitp->ltc1427_oflag = FEXCL; in ltc1427_open()
178 if (unitp->ltc1427_oflag == FEXCL) { in ltc1427_open()
181 unitp->ltc1427_oflag = FOPEN; in ltc1427_open()
185 mutex_exit(&unitp->ltc1427_mutex); in ltc1427_open()
195 struct ltc1427_unit *unitp; in ltc1427_close() local
204 unitp = (struct ltc1427_unit *) in ltc1427_close()
207 if (unitp == NULL) { in ltc1427_close()
211 mutex_enter(&unitp->ltc1427_mutex); in ltc1427_close()
213 unitp->ltc1427_oflag = 0; in ltc1427_close()
215 mutex_exit(&unitp->ltc1427_mutex); in ltc1427_close()
225 struct ltc1427_unit *unitp; in ltc1427_ioctl() local
238 unitp = (struct ltc1427_unit *) in ltc1427_ioctl()
241 mutex_enter(&unitp->ltc1427_mutex); in ltc1427_ioctl()
246 unitp->current_set_flag)); in ltc1427_ioctl()
247 if (unitp->current_set_flag == 0) { in ltc1427_ioctl()
251 if (ddi_copyout((caddr_t)&unitp->current_value, in ltc1427_ioctl()
257 unitp->ltc1427_name)); in ltc1427_ioctl()
270 unitp->ltc1427_name)); in ltc1427_ioctl()
275 (void) i2c_transfer_alloc(unitp->ltc1427_hdl, in ltc1427_ioctl()
281 unitp->ltc1427_name)); in ltc1427_ioctl()
291 err = i2c_transfer(unitp->ltc1427_hdl, i2c_tran_pointer); in ltc1427_ioctl()
293 unitp->current_value = fan_speed; in ltc1427_ioctl()
294 unitp->current_set_flag = 1; in ltc1427_ioctl()
296 i2c_transfer_free(unitp->ltc1427_hdl, i2c_tran_pointer); in ltc1427_ioctl()
301 unitp->ltc1427_name, cmd)); in ltc1427_ioctl()
305 mutex_exit(&unitp->ltc1427_mutex); in ltc1427_ioctl()
338 struct ltc1427_unit *unitp; in ltc1427_do_attach() local
349 unitp = ddi_get_soft_state(ltc1427soft_statep, instance); in ltc1427_do_attach()
351 if (unitp == NULL) { in ltc1427_do_attach()
357 (void) snprintf(unitp->ltc1427_name, sizeof (unitp->ltc1427_name), in ltc1427_do_attach()
363 "%s\n", unitp->ltc1427_name, "ltc1427"); in ltc1427_do_attach()
369 if (i2c_client_register(dip, &unitp->ltc1427_hdl) != I2C_SUCCESS) { in ltc1427_do_attach()
376 mutex_init(&unitp->ltc1427_mutex, NULL, MUTEX_DRIVER, NULL); in ltc1427_do_attach()
400 struct ltc1427_unit *unitp; in ltc1427_do_detach() local
405 unitp = ddi_get_soft_state(ltc1427soft_statep, instance); in ltc1427_do_detach()
407 if (unitp == NULL) { in ltc1427_do_detach()
413 i2c_client_unregister(unitp->ltc1427_hdl); in ltc1427_do_detach()
417 mutex_destroy(&unitp->ltc1427_mutex); in ltc1427_do_detach()