Hi Sam,

|   Sorry for not doing this SubmittingPatches-compliantly the first time,
| I hope I got everything all right this time.

 I think you did, but I can't resist to make some minor comments. :)

| +static ssize_t set_speed(struct device *dev, struct device_attribute *attr,
| +                      const char *buf, size_t count)
| +{
| +     struct usb_interface *intf = to_usb_interface(dev);
| +     struct trancevibrator *tv = usb_get_intfdata(intf);
| +     int temp, retval;
| +
| +     temp = simple_strtoul(buf, NULL, 10);
| +     if (temp > 255)
| +             temp = 255;
| +     else if (temp < 0)
| +             temp = 0;
| +     tv->speed = temp;
| +
| +     dev_dbg(&tv->udev->dev, "speed = %d\n", tv->speed);
| +
| +     /* Set speed */
| +     retval = usb_control_msg(tv->udev, usb_sndctrlpipe(tv->udev, 0),
| +                              0x01, /* vendor request: set speed */
| +                              USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_OTHER,
| +                              tv->speed, /* speed value */
| +                              0, NULL, 0, USB_CTRL_GET_TIMEOUT);
| +     if (retval)
| +             dev_dbg(&tv->udev->dev, "retval = %d\n", retval);

 Isn't it good to report an error here?

| +     return count;
| +}
| +
| +static DEVICE_ATTR(speed, S_IWUGO | S_IRUGO, show_speed, set_speed);
| +
| +static int tv_probe(struct usb_interface *interface,
| +                 const struct usb_device_id *id)
| +{
| +     struct usb_device *udev = interface_to_usbdev(interface);
| +     struct trancevibrator *dev = NULL;
| +     int retval = -ENOMEM;

 You don't need to initialize 'dev', and you can drop 'retval' and return
-ENOMEM directly in the error label.

| +
| +     dev = kzalloc(sizeof(struct trancevibrator), GFP_KERNEL);
| +     if (dev == NULL) {
| +             dev_err(&interface->dev, "Out of memory\n");
| +             goto error;
| +     }
| +
| +     dev->udev = usb_get_dev(udev);
| +     usb_set_intfdata (interface, dev);
| +     device_create_file(&interface->dev, &dev_attr_speed);

 Shouldn't the probe fail if device_create_file() fail?

| +
| +     return 0;
| +
| +error:
| +     kfree(dev);
| +     return retval;
| +}
| +
| +static void tv_disconnect(struct usb_interface *interface)
| +{
| +     struct trancevibrator *dev;
| +
| +     dev = usb_get_intfdata (interface);
| +     usb_set_intfdata (interface, NULL);
| +     device_remove_file(&interface->dev, &dev_attr_speed);
| +     usb_put_dev(dev->udev);
| +     kfree(dev);
| +}
| +
| +static int __init tv_init(void)
| +{
| +     int retval = usb_register(&tv_driver);
| +     if (retval) {
| +             err("usb_register failed. Error number %d", retval);
| +             return retval;
| +     }
| +
| +     info(DRIVER_VERSION ":" DRIVER_DESC);
| +     return 0;
| +}
| +
| +static void __exit tv_exit(void)
| +{
| +     usb_deregister(&tv_driver);
| +}
| +
| +module_init (tv_init);
| +module_exit (tv_exit);
| +
| +MODULE_AUTHOR(DRIVER_AUTHOR);
| +MODULE_DESCRIPTION(DRIVER_DESC);
| +MODULE_LICENSE("GPL");
| 
| 
| -------------------------------------------------------------------------
| Using Tomcat but need to do more? Need to support web services, security?
| Get stuff done quickly with pre-integrated technology to make your job easier
| Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
| http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
| _______________________________________________
| linux-usb-devel@lists.sourceforge.net
| To unsubscribe, use the last form field at:
| https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


-- 
Luiz Fernando N. Capitulino

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to