Lines Matching refs:d

26 static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs)  in dvb_usb_adapter_init()  argument
31 for (n = 0; n < d->props.num_adapters; n++) { in dvb_usb_adapter_init()
32 adap = &d->adapter[n]; in dvb_usb_adapter_init()
33 adap->dev = d; in dvb_usb_adapter_init()
36 memcpy(&adap->props, &d->props.adapter[n], sizeof(struct dvb_usb_adapter_properties)); in dvb_usb_adapter_init()
41 if (d->udev->speed == USB_SPEED_FULL && !(props->caps & DVB_USB_ADAP_HAS_PID_FILTER)) { in dvb_usb_adapter_init()
46 if ((d->udev->speed == USB_SPEED_FULL && props->caps & DVB_USB_ADAP_HAS_PID_FILTER) || in dvb_usb_adapter_init()
98 d->num_adapters_initialized++; in dvb_usb_adapter_init()
99 d->state |= DVB_USB_STATE_DVB; in dvb_usb_adapter_init()
106 if (d->props.generic_bulk_ctrl_endpoint != 0) { in dvb_usb_adapter_init()
107 usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); in dvb_usb_adapter_init()
108 usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); in dvb_usb_adapter_init()
122 static int dvb_usb_adapter_exit(struct dvb_usb_device *d) in dvb_usb_adapter_exit() argument
126 for (n = 0; n < d->num_adapters_initialized; n++) { in dvb_usb_adapter_exit()
127 dvb_usb_adapter_frontend_exit(&d->adapter[n]); in dvb_usb_adapter_exit()
128 dvb_usb_adapter_dvb_exit(&d->adapter[n]); in dvb_usb_adapter_exit()
129 dvb_usb_adapter_stream_exit(&d->adapter[n]); in dvb_usb_adapter_exit()
130 kfree(d->adapter[n].priv); in dvb_usb_adapter_exit()
132 d->num_adapters_initialized = 0; in dvb_usb_adapter_exit()
133 d->state &= ~DVB_USB_STATE_DVB; in dvb_usb_adapter_exit()
139 static int dvb_usb_exit(struct dvb_usb_device *d) in dvb_usb_exit() argument
141 deb_info("state before exiting everything: %x\n", d->state); in dvb_usb_exit()
142 dvb_usb_remote_exit(d); in dvb_usb_exit()
143 dvb_usb_adapter_exit(d); in dvb_usb_exit()
144 dvb_usb_i2c_exit(d); in dvb_usb_exit()
145 deb_info("state should be zero now: %x\n", d->state); in dvb_usb_exit()
146 d->state = DVB_USB_STATE_INIT; in dvb_usb_exit()
148 if (d->priv != NULL && d->props.priv_destroy != NULL) in dvb_usb_exit()
149 d->props.priv_destroy(d); in dvb_usb_exit()
151 kfree(d->priv); in dvb_usb_exit()
152 kfree(d); in dvb_usb_exit()
156 static int dvb_usb_init(struct dvb_usb_device *d, short *adapter_nums) in dvb_usb_init() argument
160 mutex_init(&d->data_mutex); in dvb_usb_init()
161 mutex_init(&d->usb_mutex); in dvb_usb_init()
162 mutex_init(&d->i2c_mutex); in dvb_usb_init()
164 d->state = DVB_USB_STATE_INIT; in dvb_usb_init()
166 if (d->props.size_of_priv > 0) { in dvb_usb_init()
167 d->priv = kzalloc(d->props.size_of_priv, GFP_KERNEL); in dvb_usb_init()
168 if (d->priv == NULL) { in dvb_usb_init()
173 if (d->props.priv_init != NULL) { in dvb_usb_init()
174 ret = d->props.priv_init(d); in dvb_usb_init()
181 dvb_usb_device_power_ctrl(d, 1); in dvb_usb_init()
183 ret = dvb_usb_i2c_init(d); in dvb_usb_init()
186 ret = dvb_usb_adapter_init(d, adapter_nums); in dvb_usb_init()
190 if ((ret = dvb_usb_remote_init(d))) in dvb_usb_init()
193 dvb_usb_device_power_ctrl(d, 0); in dvb_usb_init()
198 dvb_usb_adapter_exit(d); in dvb_usb_init()
199 dvb_usb_i2c_exit(d); in dvb_usb_init()
201 if (d->priv && d->props.priv_destroy) in dvb_usb_init()
202 d->props.priv_destroy(d); in dvb_usb_init()
204 kfree(d->priv); in dvb_usb_init()
205 d->priv = NULL; in dvb_usb_init()
249 int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff) in dvb_usb_device_power_ctrl() argument
252 d->powered++; in dvb_usb_device_power_ctrl()
254 d->powered--; in dvb_usb_device_power_ctrl()
256 …if (d->powered == 0 || (onoff && d->powered == 1)) { /* when switching from 1 to 0 or from 0 to 1 … in dvb_usb_device_power_ctrl()
258 if (d->props.power_ctrl) in dvb_usb_device_power_ctrl()
259 return d->props.power_ctrl(d, onoff); in dvb_usb_device_power_ctrl()
273 struct dvb_usb_device *d = NULL; in dvb_usb_device_init() local
281 d = kzalloc(sizeof(*d), GFP_KERNEL); in dvb_usb_device_init()
282 if (!d) { in dvb_usb_device_init()
287 memcpy(&d->props, props, sizeof(struct dvb_usb_device_properties)); in dvb_usb_device_init()
289 desc = dvb_usb_find_device(udev, &d->props, &cold); in dvb_usb_device_init()
304 d->udev = udev; in dvb_usb_device_init()
305 d->desc = desc; in dvb_usb_device_init()
306 d->owner = owner; in dvb_usb_device_init()
308 usb_set_intfdata(intf, d); in dvb_usb_device_init()
310 ret = dvb_usb_init(d, adapter_nums); in dvb_usb_device_init()
317 *du = d; in dvb_usb_device_init()
324 kfree(d); in dvb_usb_device_init()
331 struct dvb_usb_device *d = usb_get_intfdata(intf); in dvb_usb_device_exit() local
336 if (d != NULL && d->desc != NULL) { in dvb_usb_device_exit()
337 strscpy(name, d->desc->name, sizeof(name)); in dvb_usb_device_exit()
338 dvb_usb_exit(d); in dvb_usb_device_exit()