• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/drivers/usb/misc/

Lines Matching defs:mc

56 static int set_motor(struct motorcontrol *mc, int motor)
64 dev_err(&mc->intf->dev, "%s - out of memory\n", __FUNCTION__);
68 acceleration = mc->acceleration[motor] * 10;
70 speed = (mc->desired_speed[motor] * 127) / 100;
72 speed2 = (mc->desired_speed[motor] * 230 * 128) / 100;
81 retval = usb_control_msg(mc->udev,
82 usb_sndctrlpipe(mc->udev, 0),
86 dev_err(&mc->intf->dev, "usb_control_msg returned %d\n",
95 struct motorcontrol *mc = urb->context;
96 unsigned char *buffer = mc->data;
115 if (mc->inputs[i] != level) {
116 mc->inputs[i] = level;
117 set_bit(i, &mc->input_events);
125 if (mc->speed[i] != level) {
126 mc->speed[i] = level;
127 set_bit(i, &mc->speed_events);
135 if (mc->speed[index] != level) {
136 mc->speed[index] = level;
137 set_bit(index, &mc->speed_events);
141 mc->_current[index] = level * 100 / 1572;
145 set_bit(0, &mc->exceed_events);
148 set_bit(1, &mc->exceed_events);
150 if (mc->input_events || mc->exceed_events || mc->speed_events)
151 schedule_delayed_work(&mc->do_notify, 0);
156 dev_err(&mc->intf->dev,
158 mc->udev->bus->bus_name,
159 mc->udev->devpath, status);
164 struct motorcontrol *mc =
170 if (test_and_clear_bit(i, &mc->input_events)) {
172 sysfs_notify(&mc->dev->kobj, NULL, sysfs_file);
177 if (test_and_clear_bit(i, &mc->speed_events)) {
179 sysfs_notify(&mc->dev->kobj, NULL, sysfs_file);
184 if (test_and_clear_bit(i, &mc->exceed_events))
185 dev_warn(&mc->intf->dev,
195 struct motorcontrol *mc = dev_get_drvdata(dev); \
205 mc->desired_speed[value] = speed; \
207 retval = set_motor(mc, value); \
216 struct motorcontrol *mc = dev_get_drvdata(dev); \
218 return sprintf(buf, "%d\n", mc->speed[value]); \
233 struct motorcontrol *mc = dev_get_drvdata(dev); \
243 mc->acceleration[value] = acceleration; \
245 retval = set_motor(mc, value); \
254 struct motorcontrol *mc = dev_get_drvdata(dev); \
256 return sprintf(buf, "%d\n", mc->acceleration[value]); \
271 struct motorcontrol *mc = dev_get_drvdata(dev); \
273 return sprintf(buf, "%dmA\n", (int)mc->_current[value]); \
287 struct motorcontrol *mc = dev_get_drvdata(dev); \
289 return sprintf(buf, "%d\n", (int)mc->inputs[value]); \
318 struct motorcontrol *mc;
336 mc = kzalloc(sizeof(*mc), GFP_KERNEL);
337 if (!mc)
340 mc->dev_no = -1;
341 mc->data = usb_buffer_alloc(dev, URB_INT_SIZE, GFP_ATOMIC, &mc->data_dma);
342 if (!mc->data)
345 mc->irq = usb_alloc_urb(0, GFP_KERNEL);
346 if (!mc->irq)
349 mc->udev = usb_get_dev(dev);
350 mc->intf = intf;
351 mc->acceleration[0] = mc->acceleration[1] = 10;
352 INIT_DELAYED_WORK(&mc->do_notify, do_notify);
353 usb_fill_int_urb(mc->irq, mc->udev, pipe, mc->data,
355 motorcontrol_irq, mc, endpoint->bInterval);
356 mc->irq->transfer_dma = mc->data_dma;
357 mc->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
359 usb_set_intfdata(intf, mc);
365 mc->dev_no = bit;
367 mc->dev = device_create(phidget_class, &mc->udev->dev, 0,
368 "motorcontrol%d", mc->dev_no);
369 if (IS_ERR(mc->dev)) {
370 rc = PTR_ERR(mc->dev);
371 mc->dev = NULL;
375 dev_set_drvdata(mc->dev, mc);
377 if (usb_submit_urb(mc->irq, GFP_KERNEL)) {
383 rc = device_create_file(mc->dev, &dev_attrs[i]);
393 device_remove_file(mc->dev, &dev_attrs[i]);
395 if (mc) {
396 usb_free_urb(mc->irq);
397 if (mc->data)
398 usb_buffer_free(dev, URB_INT_SIZE, mc->data, mc->data_dma);
399 if (mc->dev)
400 device_unregister(mc->dev);
401 if (mc->dev_no >= 0)
402 clear_bit(mc->dev_no, &device_no);
404 kfree(mc);
412 struct motorcontrol *mc;
415 mc = usb_get_intfdata(interface);
417 if (!mc)
420 usb_kill_urb(mc->irq);
421 usb_free_urb(mc->irq);
422 usb_buffer_free(mc->udev, URB_INT_SIZE, mc->data, mc->data_dma);
424 cancel_delayed_work(&mc->do_notify);
427 device_remove_file(mc->dev, &dev_attrs[i]);
429 device_unregister(mc->dev);
431 usb_put_dev(mc->udev);
432 clear_bit(mc->dev_no, &device_no);
433 kfree(mc);