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:	Mon, 12 Mar 2012 17:09:40 +0100 (CET)
From:	Jiri Kosina <jkosina@...e.cz>
To:	Simon Wood <simon@...gewell.org>
Cc:	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
	Michael Bauer <michael@...auer.org>,
	Michal Maly <madcatxster@...il.com>
Subject: Re: [PATCH 1/2] HID: hid-lg4ff add support for G27 LEDs

On Mon, 12 Mar 2012, Simon Wood wrote:

> This patch adds support for the G27 LEDs. The LEDs are controlled
> by a 5bit value (0-31) where bit0 is the right most LED, the LEDs
> are mirrored to the left.
> 
> Arrangement on wheel is:
>    G G Y Y R R(bit4) Y Y G G(bit0)
> 
> Signed-off-by: Simon Wood <simon@...gewell.org>
> ---
>  drivers/hid/hid-lg4ff.c |   84 +++++++++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 82 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
> index 6ecc9e2..4f3b744 100644
> --- a/drivers/hid/hid-lg4ff.c
> +++ b/drivers/hid/hid-lg4ff.c
> @@ -49,7 +49,12 @@ static void hid_lg4ff_set_range_g25(struct hid_device *hid, u16 range);
>  static ssize_t lg4ff_range_show(struct device *dev, struct device_attribute *attr, char *buf);
>  static ssize_t lg4ff_range_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
>  
> +static void hid_lg4ff_set_leds(struct hid_device *hid, __u8 leds);
> +static ssize_t lg4ff_leds_show(struct device *dev, struct device_attribute *attr, char *buf);
> +static ssize_t lg4ff_leds_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
> +
>  static DEVICE_ATTR(range, S_IRWXU | S_IRWXG | S_IRWXO, lg4ff_range_show, lg4ff_range_store);
> +static DEVICE_ATTR(leds, S_IRWXU | S_IRWXG | S_IRWXO, lg4ff_leds_show, lg4ff_leds_store);
>  
>  static bool list_inited;
>  
> @@ -336,6 +341,67 @@ static ssize_t lg4ff_range_store(struct device *dev, struct device_attribute *at
>  	return count;
>  }
>  
> +/* Read current state of leds and display it in terminal */
> +static ssize_t lg4ff_leds_show(struct device *dev, struct device_attribute *attr, char *buf)
> +{
> +	struct lg4ff_device_entry *uninitialized_var(entry);
> +	struct list_head *h;
> +	struct hid_device *hid = to_hid_device(dev);
> +	size_t count;
> +
> +	list_for_each(h, &device_list.list) {
> +		entry = list_entry(h, struct lg4ff_device_entry, list);
> +		if (strcmp(entry->device_id, (&hid->dev)->kobj.name) == 0)
> +			break;
> +	}

Please correct me if I am wrong, but I don't see nothing that'd prevent 
this racing with lg4ff_deinit().

The same applies to already existing sysfs attributes actually.

-- 
Jiri Kosina
SUSE Labs
--
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