lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 20 Oct 2009 21:35:53 -0700
From:	Dmitry Torokhov <dmitry.torokhov@...il.com>
To:	Daniel Mack <daniel@...aq.de>
Cc:	Richard Purdie <rpurdie@...ys.net>, linux-kernel@...r.kernel.org,
	linux-input@...r.kernel.org, Constantin Baranov <const@...as.ru>
Subject: Re: [PATCH] leds-alix2: add support for button connected to J15

Hi Daniel,

On Tue, Oct 20, 2009 at 12:13:57PM +0200, Daniel Mack wrote:
> +
> +	ret = input_register_polled_device(ipdev);
> +	
> +	if (ret) {
> +		input_free_polled_device(ipdev);
> +		ipdev = NULL;
> +	}
> +
> +	return ret;
> +}

Ah, don't be lazy ;)

static void alix_button_unregister(void)
{
	if (ipdev) {
		input_unregister_polled_device(ipdev);
		/* Yes, polled devices need to be freed */
		input_free_polled_device(ipdev);
		ipdev = NULL;
	}
}

> +#else
> +#define alix_button_register() (0)

static inline int alix_button_register(void) { return 0; }
static inline void alix_button_unregister(void) { }

So you get typechecking (if any).

> +#endif
> +
>  static int __init alix_led_probe(struct platform_device *pdev)
>  {
>  	int i;
> @@ -89,6 +139,11 @@ static int __init alix_led_probe(struct platform_device *pdev)
>  		if (ret < 0)
>  			goto fail;
>  	}
> +
> +	ret = alix_button_register();
> +	if (ret) 
> +		goto fail;
> +
>  	return 0;
>  
>  fail:
> @@ -103,6 +158,12 @@ static int alix_led_remove(struct platform_device *pdev)
>  
>  	for (i = 0; i < ARRAY_SIZE(alix_leds); i++)
>  		led_classdev_unregister(&alix_leds[i].cdev);
> +
> +#ifdef CONFIG_LEDS_ALIX2_BUTTON
> +	if (ipdev)
> +		input_unregister_polled_device(ipdev);
> +#endif

	alix_button_unregister();

> +
>  	return 0;
>  }
>  

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ