diff options
Diffstat (limited to 'drivers/usb/input/acecad.c')
-rw-r--r-- | drivers/usb/input/acecad.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/usb/input/acecad.c b/drivers/usb/input/acecad.c index 909138e5aa04..be8e9243c062 100644 --- a/drivers/usb/input/acecad.c +++ b/drivers/usb/input/acecad.c | |||
@@ -111,7 +111,7 @@ resubmit: | |||
111 | 111 | ||
112 | static int usb_acecad_open(struct input_dev *dev) | 112 | static int usb_acecad_open(struct input_dev *dev) |
113 | { | 113 | { |
114 | struct usb_acecad *acecad = dev->private; | 114 | struct usb_acecad *acecad = input_get_drvdata(dev); |
115 | 115 | ||
116 | acecad->irq->dev = acecad->usbdev; | 116 | acecad->irq->dev = acecad->usbdev; |
117 | if (usb_submit_urb(acecad->irq, GFP_KERNEL)) | 117 | if (usb_submit_urb(acecad->irq, GFP_KERNEL)) |
@@ -122,7 +122,7 @@ static int usb_acecad_open(struct input_dev *dev) | |||
122 | 122 | ||
123 | static void usb_acecad_close(struct input_dev *dev) | 123 | static void usb_acecad_close(struct input_dev *dev) |
124 | { | 124 | { |
125 | struct usb_acecad *acecad = dev->private; | 125 | struct usb_acecad *acecad = input_get_drvdata(dev); |
126 | 126 | ||
127 | usb_kill_urb(acecad->irq); | 127 | usb_kill_urb(acecad->irq); |
128 | } | 128 | } |
@@ -135,6 +135,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ | |||
135 | struct usb_acecad *acecad; | 135 | struct usb_acecad *acecad; |
136 | struct input_dev *input_dev; | 136 | struct input_dev *input_dev; |
137 | int pipe, maxp; | 137 | int pipe, maxp; |
138 | int err = -ENOMEM; | ||
138 | 139 | ||
139 | if (interface->desc.bNumEndpoints != 1) | 140 | if (interface->desc.bNumEndpoints != 1) |
140 | return -ENODEV; | 141 | return -ENODEV; |
@@ -149,16 +150,22 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ | |||
149 | 150 | ||
150 | acecad = kzalloc(sizeof(struct usb_acecad), GFP_KERNEL); | 151 | acecad = kzalloc(sizeof(struct usb_acecad), GFP_KERNEL); |
151 | input_dev = input_allocate_device(); | 152 | input_dev = input_allocate_device(); |
152 | if (!acecad || !input_dev) | 153 | if (!acecad || !input_dev) { |
154 | err = -ENOMEM; | ||
153 | goto fail1; | 155 | goto fail1; |
156 | } | ||
154 | 157 | ||
155 | acecad->data = usb_buffer_alloc(dev, 8, GFP_KERNEL, &acecad->data_dma); | 158 | acecad->data = usb_buffer_alloc(dev, 8, GFP_KERNEL, &acecad->data_dma); |
156 | if (!acecad->data) | 159 | if (!acecad->data) { |
160 | err= -ENOMEM; | ||
157 | goto fail1; | 161 | goto fail1; |
162 | } | ||
158 | 163 | ||
159 | acecad->irq = usb_alloc_urb(0, GFP_KERNEL); | 164 | acecad->irq = usb_alloc_urb(0, GFP_KERNEL); |
160 | if (!acecad->irq) | 165 | if (!acecad->irq) { |
166 | err = -ENOMEM; | ||
161 | goto fail2; | 167 | goto fail2; |
168 | } | ||
162 | 169 | ||
163 | acecad->usbdev = dev; | 170 | acecad->usbdev = dev; |
164 | acecad->input = input_dev; | 171 | acecad->input = input_dev; |
@@ -178,8 +185,9 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ | |||
178 | input_dev->name = acecad->name; | 185 | input_dev->name = acecad->name; |
179 | input_dev->phys = acecad->phys; | 186 | input_dev->phys = acecad->phys; |
180 | usb_to_input_id(dev, &input_dev->id); | 187 | usb_to_input_id(dev, &input_dev->id); |
181 | input_dev->cdev.dev = &intf->dev; | 188 | input_dev->dev.parent = &intf->dev; |
182 | input_dev->private = acecad; | 189 | |
190 | input_set_drvdata(input_dev, acecad); | ||
183 | 191 | ||
184 | input_dev->open = usb_acecad_open; | 192 | input_dev->open = usb_acecad_open; |
185 | input_dev->close = usb_acecad_close; | 193 | input_dev->close = usb_acecad_close; |
@@ -221,7 +229,9 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ | |||
221 | acecad->irq->transfer_dma = acecad->data_dma; | 229 | acecad->irq->transfer_dma = acecad->data_dma; |
222 | acecad->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 230 | acecad->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
223 | 231 | ||
224 | input_register_device(acecad->input); | 232 | err = input_register_device(acecad->input); |
233 | if (err) | ||
234 | goto fail2; | ||
225 | 235 | ||
226 | usb_set_intfdata(intf, acecad); | 236 | usb_set_intfdata(intf, acecad); |
227 | 237 | ||
@@ -230,7 +240,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ | |||
230 | fail2: usb_buffer_free(dev, 8, acecad->data, acecad->data_dma); | 240 | fail2: usb_buffer_free(dev, 8, acecad->data, acecad->data_dma); |
231 | fail1: input_free_device(input_dev); | 241 | fail1: input_free_device(input_dev); |
232 | kfree(acecad); | 242 | kfree(acecad); |
233 | return -ENOMEM; | 243 | return err; |
234 | } | 244 | } |
235 | 245 | ||
236 | static void usb_acecad_disconnect(struct usb_interface *intf) | 246 | static void usb_acecad_disconnect(struct usb_interface *intf) |