diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-03-20 01:18:15 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-04-14 02:24:11 -0400 |
commit | 51269fe86c263ec4fafbafe82970e6d7f6f79102 (patch) | |
tree | 95b0b767cbceef5a6bc8918e4e22b3962ec7a23e /drivers/input/tablet | |
parent | 4492efffffeb88d87e7aa74765f3c53b3a7dd40f (diff) |
Input: wacom - do not allocate wacom_wac separately
There is no reason for allocating struct wacom_wac separately from
struct wacom since both have the same lifetime rules and are not
shared. Also make 'open' field a boolean.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/tablet')
-rw-r--r-- | drivers/input/tablet/wacom.h | 4 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_sys.c | 21 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_wac.c | 3 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_wac.h | 2 |
4 files changed, 15 insertions, 15 deletions
diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h index 8fef1b689c69..fdb1d16b9471 100644 --- a/drivers/input/tablet/wacom.h +++ b/drivers/input/tablet/wacom.h | |||
@@ -110,9 +110,9 @@ struct wacom { | |||
110 | struct usb_device *usbdev; | 110 | struct usb_device *usbdev; |
111 | struct usb_interface *intf; | 111 | struct usb_interface *intf; |
112 | struct urb *irq; | 112 | struct urb *irq; |
113 | struct wacom_wac *wacom_wac; | 113 | struct wacom_wac wacom_wac; |
114 | struct mutex lock; | 114 | struct mutex lock; |
115 | unsigned int open:1; | 115 | bool open; |
116 | char phys[32]; | 116 | char phys[32]; |
117 | }; | 117 | }; |
118 | 118 | ||
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index a03ca219d49f..0e5e56cef7f0 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -11,8 +11,8 @@ | |||
11 | * (at your option) any later version. | 11 | * (at your option) any later version. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "wacom.h" | ||
15 | #include "wacom_wac.h" | 14 | #include "wacom_wac.h" |
15 | #include "wacom.h" | ||
16 | 16 | ||
17 | /* defines to get HID report descriptor */ | 17 | /* defines to get HID report descriptor */ |
18 | #define HID_DEVICET_HID (USB_TYPE_CLASS | 0x01) | 18 | #define HID_DEVICET_HID (USB_TYPE_CLASS | 0x01) |
@@ -99,7 +99,7 @@ static void wacom_sys_irq(struct urb *urb) | |||
99 | wcombo.wacom = wacom; | 99 | wcombo.wacom = wacom; |
100 | wcombo.urb = urb; | 100 | wcombo.urb = urb; |
101 | 101 | ||
102 | if (wacom_wac_irq(wacom->wacom_wac, (void *)&wcombo)) | 102 | if (wacom_wac_irq(&wacom->wacom_wac, (void *)&wcombo)) |
103 | input_sync(get_input_dev(&wcombo)); | 103 | input_sync(get_input_dev(&wcombo)); |
104 | 104 | ||
105 | exit: | 105 | exit: |
@@ -168,7 +168,7 @@ static int wacom_open(struct input_dev *dev) | |||
168 | return -EIO; | 168 | return -EIO; |
169 | } | 169 | } |
170 | 170 | ||
171 | wacom->open = 1; | 171 | wacom->open = true; |
172 | wacom->intf->needs_remote_wakeup = 1; | 172 | wacom->intf->needs_remote_wakeup = 1; |
173 | 173 | ||
174 | mutex_unlock(&wacom->lock); | 174 | mutex_unlock(&wacom->lock); |
@@ -181,7 +181,7 @@ static void wacom_close(struct input_dev *dev) | |||
181 | 181 | ||
182 | mutex_lock(&wacom->lock); | 182 | mutex_lock(&wacom->lock); |
183 | usb_kill_urb(wacom->irq); | 183 | usb_kill_urb(wacom->irq); |
184 | wacom->open = 0; | 184 | wacom->open = false; |
185 | wacom->intf->needs_remote_wakeup = 0; | 185 | wacom->intf->needs_remote_wakeup = 0; |
186 | mutex_unlock(&wacom->lock); | 186 | mutex_unlock(&wacom->lock); |
187 | } | 187 | } |
@@ -617,13 +617,13 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
617 | return -EINVAL; | 617 | return -EINVAL; |
618 | 618 | ||
619 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); | 619 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); |
620 | wacom_wac = kzalloc(sizeof(struct wacom_wac), GFP_KERNEL); | ||
621 | input_dev = input_allocate_device(); | 620 | input_dev = input_allocate_device(); |
622 | if (!wacom || !input_dev || !wacom_wac) { | 621 | if (!wacom || !input_dev) { |
623 | error = -ENOMEM; | 622 | error = -ENOMEM; |
624 | goto fail1; | 623 | goto fail1; |
625 | } | 624 | } |
626 | 625 | ||
626 | wacom_wac = &wacom->wacom_wac; | ||
627 | wacom_wac->features = *((struct wacom_features *)id->driver_info); | 627 | wacom_wac->features = *((struct wacom_features *)id->driver_info); |
628 | features = &wacom_wac->features; | 628 | features = &wacom_wac->features; |
629 | if (features->pktlen > WACOM_PKGLEN_MAX) { | 629 | if (features->pktlen > WACOM_PKGLEN_MAX) { |
@@ -682,7 +682,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
682 | } | 682 | } |
683 | 683 | ||
684 | input_dev->name = wacom_wac->name; | 684 | input_dev->name = wacom_wac->name; |
685 | wacom->wacom_wac = wacom_wac; | ||
686 | 685 | ||
687 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 686 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
688 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOUCH); | 687 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOUCH); |
@@ -716,7 +715,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
716 | fail2: usb_buffer_free(dev, WACOM_PKGLEN_MAX, wacom_wac->data, wacom->data_dma); | 715 | fail2: usb_buffer_free(dev, WACOM_PKGLEN_MAX, wacom_wac->data, wacom->data_dma); |
717 | fail1: input_free_device(input_dev); | 716 | fail1: input_free_device(input_dev); |
718 | kfree(wacom); | 717 | kfree(wacom); |
719 | kfree(wacom_wac); | ||
720 | return error; | 718 | return error; |
721 | } | 719 | } |
722 | 720 | ||
@@ -730,9 +728,8 @@ static void wacom_disconnect(struct usb_interface *intf) | |||
730 | input_unregister_device(wacom->dev); | 728 | input_unregister_device(wacom->dev); |
731 | usb_free_urb(wacom->irq); | 729 | usb_free_urb(wacom->irq); |
732 | usb_buffer_free(interface_to_usbdev(intf), WACOM_PKGLEN_MAX, | 730 | usb_buffer_free(interface_to_usbdev(intf), WACOM_PKGLEN_MAX, |
733 | wacom->wacom_wac->data, wacom->data_dma); | 731 | wacom->wacom_wac.data, wacom->data_dma); |
734 | wacom_remove_shared_data(wacom->wacom_wac); | 732 | wacom_remove_shared_data(&wacom->wacom_wac); |
735 | kfree(wacom->wacom_wac); | ||
736 | kfree(wacom); | 733 | kfree(wacom); |
737 | } | 734 | } |
738 | 735 | ||
@@ -750,7 +747,7 @@ static int wacom_suspend(struct usb_interface *intf, pm_message_t message) | |||
750 | static int wacom_resume(struct usb_interface *intf) | 747 | static int wacom_resume(struct usb_interface *intf) |
751 | { | 748 | { |
752 | struct wacom *wacom = usb_get_intfdata(intf); | 749 | struct wacom *wacom = usb_get_intfdata(intf); |
753 | struct wacom_features *features = &wacom->wacom_wac->features; | 750 | struct wacom_features *features = &wacom->wacom_wac.features; |
754 | int rv; | 751 | int rv; |
755 | 752 | ||
756 | mutex_lock(&wacom->lock); | 753 | mutex_lock(&wacom->lock); |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 428144af865f..2d7aee0bd289 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -11,8 +11,9 @@ | |||
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * the Free Software Foundation; either version 2 of the License, or |
12 | * (at your option) any later version. | 12 | * (at your option) any later version. |
13 | */ | 13 | */ |
14 | #include "wacom.h" | 14 | |
15 | #include "wacom_wac.h" | 15 | #include "wacom_wac.h" |
16 | #include "wacom.h" | ||
16 | 17 | ||
17 | static int wacom_penpartner_irq(struct wacom_wac *wacom, void *wcombo) | 18 | static int wacom_penpartner_irq(struct wacom_wac *wacom, void *wcombo) |
18 | { | 19 | { |
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index 4b55fc7ad8ae..f190a2bf148f 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #ifndef WACOM_WAC_H | 9 | #ifndef WACOM_WAC_H |
10 | #define WACOM_WAC_H | 10 | #define WACOM_WAC_H |
11 | 11 | ||
12 | #include <linux/types.h> | ||
13 | |||
12 | /* maximum packet length for USB devices */ | 14 | /* maximum packet length for USB devices */ |
13 | #define WACOM_PKGLEN_MAX 32 | 15 | #define WACOM_PKGLEN_MAX 32 |
14 | 16 | ||