Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / usb / misc / phidgetkit.c
index ddbf8e9..997db5d 100644 (file)
@@ -88,7 +88,7 @@ static int change_outputs(struct phidget_interfacekit *kit, int output_num, int
        int retval;
        int n;
 
-       buffer = kmalloc(4, GFP_KERNEL);
+       buffer = kzalloc(4, GFP_KERNEL);
        if (!buffer) {
                dev_err(&kit->udev->dev, "%s - out of memory\n",
                        __FUNCTION__);
@@ -96,7 +96,6 @@ static int change_outputs(struct phidget_interfacekit *kit, int output_num, int
        }
 
        kit->outputs[output_num] = enable;
-       memset(buffer, 0, 4);
        for (n=0; n<8; n++) {
                if (kit->outputs[n]) {
                        buffer[0] |= 1 << n;
@@ -173,7 +172,7 @@ exit:
 }
 
 #define set_lcd_line(number)   \
-static ssize_t lcd_line_##number(struct device *dev, const char *buf, size_t count)    \
+static ssize_t lcd_line_##number(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)     \
 {                                                                                      \
        struct usb_interface *intf = to_usb_interface(dev);                             \
        struct phidget_interfacekit *kit = usb_get_intfdata(intf);                      \
@@ -184,7 +183,7 @@ static DEVICE_ATTR(lcd_line_##number, S_IWUGO, NULL, lcd_line_##number);
 set_lcd_line(1);
 set_lcd_line(2);
 
-static ssize_t set_backlight(struct device *dev, const char *buf, size_t count)
+static ssize_t set_backlight(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
        struct usb_interface *intf = to_usb_interface(dev);
        struct phidget_interfacekit *kit = usb_get_intfdata(intf);
@@ -192,7 +191,7 @@ static ssize_t set_backlight(struct device *dev, const char *buf, size_t count)
        unsigned char *buffer;
        int retval = -ENOMEM;
        
-       buffer = kmalloc(8, GFP_KERNEL);
+       buffer = kzalloc(8, GFP_KERNEL);
        if (!buffer) {
                dev_err(&kit->udev->dev, "%s - out of memory\n", __FUNCTION__);
                goto exit;
@@ -202,7 +201,6 @@ static ssize_t set_backlight(struct device *dev, const char *buf, size_t count)
                retval = -EINVAL;
                goto exit;
        }
-       memset(buffer, 0x00, 8);
        if (enabled)
                buffer[0] = 0x01;
        buffer[7] = 0x11;
@@ -232,7 +230,7 @@ static void remove_lcd_files(struct phidget_interfacekit *kit)
        }
 }
 
-static ssize_t enable_lcd_files(struct device *dev, const char *buf, size_t count)
+static ssize_t enable_lcd_files(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
        struct usb_interface *intf = to_usb_interface(dev);
        struct phidget_interfacekit *kit = usb_get_intfdata(intf);
@@ -307,7 +305,7 @@ resubmit:
 }
 
 #define show_set_output(value)         \
-static ssize_t set_output##value(struct device *dev, const char *buf,  \
+static ssize_t set_output##value(struct device *dev, struct device_attribute *attr, const char *buf,   \
                                                        size_t count)   \
 {                                                                      \
        struct usb_interface *intf = to_usb_interface(dev);             \
@@ -324,7 +322,7 @@ static ssize_t set_output##value(struct device *dev, const char *buf,       \
        return retval ? retval : count;                                 \
 }                                                                      \
                                                                        \
-static ssize_t show_output##value(struct device *dev, char *buf)       \
+static ssize_t show_output##value(struct device *dev, struct device_attribute *attr, char *buf)        \
 {                                                                      \
        struct usb_interface *intf = to_usb_interface(dev);             \
        struct phidget_interfacekit *kit = usb_get_intfdata(intf);      \
@@ -343,7 +341,7 @@ show_set_output(7);
 show_set_output(8);    /* should be MAX_INTERFACES - 1 */
 
 #define show_input(value)      \
-static ssize_t show_input##value(struct device *dev, char *buf)        \
+static ssize_t show_input##value(struct device *dev, struct device_attribute *attr, char *buf) \
 {                                                                      \
        struct usb_interface *intf = to_usb_interface(dev);             \
        struct phidget_interfacekit *kit = usb_get_intfdata(intf);      \
@@ -362,7 +360,7 @@ show_input(7);
 show_input(8);         /* should be MAX_INTERFACES - 1 */
 
 #define show_sensor(value)     \
-static ssize_t show_sensor##value(struct device *dev, char *buf)       \
+static ssize_t show_sensor##value(struct device *dev, struct device_attribute *attr, char *buf)        \
 {                                                                      \
        struct usb_interface *intf = to_usb_interface(dev);             \
        struct phidget_interfacekit *kit = usb_get_intfdata(intf);      \
@@ -406,12 +404,11 @@ static int interfacekit_probe(struct usb_interface *intf, const struct usb_devic
        pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
        maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
        
-       kit = kmalloc(sizeof(*kit), GFP_KERNEL);
+       kit = kzalloc(sizeof(*kit), GFP_KERNEL);
        if (kit  == NULL) {
                dev_err(&intf->dev, "%s - out of memory\n", __FUNCTION__);
                return -ENOMEM;
        }
-       memset(kit, 0, sizeof(*kit));
        kit->ifkit = ifkit;
 
        kit->data = usb_buffer_alloc(dev, 8, SLAB_ATOMIC, &kit->data_dma);
@@ -555,7 +552,6 @@ static void interfacekit_disconnect(struct usb_interface *interface)
 }
 
 static struct usb_driver interfacekit_driver = {
-       .owner = THIS_MODULE,
        .name = "phidgetkit",
        .probe = interfacekit_probe,
        .disconnect = interfacekit_disconnect,