Re: [PATCH 1/5] Input: wacom - isolate input registration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/06/2012 10:46 AM, chris@xxxxxxxxxxxxxx wrote:

> From: Chris Bagwell <chris@xxxxxxxxxxxxxx>
> 
> Although this better co-locates input registration logic,
> the main goal is to make it easier to optionally create
> input devices or delay creation to later time periods.
> 
> Signed-off-by: Chris Bagwell <chris@xxxxxxxxxxxxxx>
> ---
>  drivers/input/tablet/wacom_sys.c |   53 +++++++++++++++++++++++--------------
>  1 files changed, 33 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> index c9588ee..43e82e9 100644
> --- a/drivers/input/tablet/wacom_sys.c
> +++ b/drivers/input/tablet/wacom_sys.c
> @@ -822,6 +822,37 @@ static void wacom_destroy_leds(struct wacom *wacom)
>  	}
>  }
>  
> +static int wacom_register_input(struct wacom *wacom)
> +{
> +	struct input_dev *input_dev;
> +	struct usb_interface *intf = wacom->intf;
> +	struct usb_device *dev = interface_to_usbdev(intf);
> +	struct wacom_wac *wacom_wac = &(wacom->wacom_wac);
> +	int error;
> +
> +	input_dev = input_allocate_device();
> +	if (!input_dev)
> +		return -ENOMEM;
> +
> +	input_dev->name = wacom_wac->name;
> +	input_dev->dev.parent = &intf->dev;
> +	input_dev->open = wacom_open;
> +	input_dev->close = wacom_close;
> +	usb_to_input_id(dev, &input_dev->id);
> +	input_set_drvdata(input_dev, wacom);
> +
> +	wacom_wac->input = input_dev;
> +	wacom_setup_input_capabilities(input_dev, wacom_wac);
> +
> +	error = input_register_device(input_dev);
> +	if (error) {
> +		input_free_device(input_dev);
> +		wacom_wac->input =  0;

				  ^^^
spare space here. and better use NULL?

Thanks
-Wanlong Gao
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux