login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
April
»
1
Re: [PATCH v6 1/8] hid: new driver for PicoLCD device
view
thread
Previous message: [thread] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Oliver Neukum
Subject:
Re: [PATCH v6 1/8] hid: new driver for PicoLCD device
Date: Thursday, April 1, 2010 - 9:58 am
Am Dienstag, 30. März 2010 22:33:50 schrieb Bruno Prémont:
quoted text
> +static ssize_t picolcd_operation_mode_store(struct device *dev, > + struct device_attribute *attr, const char *buf, size_t count) > +{ > + struct picolcd_data *data = dev_get_drvdata(dev); > + struct hid_report *report = NULL; > + size_t cnt = count; > + int timeout = 5000; > + unsigned u; > + unsigned long flags; > + > + if (cnt >= 3 && strncmp("lcd", buf, 3) == 0) { > + if (data->status & PICOLCD_BOOTLOADER) > + report = picolcd_out_report(REPORT_EXIT_FLASHER, data->hdev); > + buf += 3; > + cnt -= 3; > + } else if (cnt >= 10 && strncmp("bootloader", buf, 10) == 0) { > + if (!(data->status & PICOLCD_BOOTLOADER)) > + report = picolcd_out_report(REPORT_EXIT_KEYBOARD, data->hdev); > + buf += 10; > + cnt -= 10; > + } > + if (!report) > + return -EINVAL; > + > + while (cnt > 0 && (*buf == ' ' || *buf == '\t')) { > + buf++; > + cnt--; > + } > + while (cnt > 0 && (buf[cnt-1] == '\n' || buf[cnt-1] == '\r')) > + cnt--; > + if (cnt > 0) { > + if (sscanf(buf, "%u", &u) != 1) > + return -EINVAL; > + if (u > 30000) > + return -EINVAL; > + else > + timeout = u; > + } > + > + spin_lock_irqsave(&data->lock, flags); > + hid_set_field(report->field[0], 0, timeout & 0xff); > + hid_set_field(report->field[0], 1, (timeout >> 8) & 0xff); > + usbhid_submit_report(data->hdev, report, USB_DIR_OUT); > + spin_unlock_irqrestore(&data->lock, flags); > + return count; > +} > + > +static DEVICE_ATTR(operation_mode, 0644, picolcd_operation_mode_show, > + picolcd_operation_mode_store);
This violates the one file == one attribute rule. Can you change this interface? Regards Oliver --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [thread] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
Re: [PATCH v6 1/8] hid: new driver for PicoLCD device
, Oliver Neukum
, (Thu Apr 1, 9:58 am)
[PATCH] hid: split picolcd's operation_mode sysfs attribute
, Bruno Prémont
, (Sun Apr 25, 12:29 pm)
Re: [PATCH] hid: split picolcd's operation_mode sysfs attr ...
, Jiri Kosina
, (Tue Apr 27, 6:32 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
FUJITA Tomonori
Re: [Scst-devel] Integration of SCST in the mainstream Linux kernel
Paul E. McKenney
Rafael J. Wysocki
[Bug #11287] Regression in 2.6.27-rc2 in acpi_processor_init()
Ingo Molnar
Re: [GIT PULL] time.c - respin
Robin Holt
Re: Linux 2.6.26-rc1
git
:
Mark Junker
git on MacOSX and files with decomposed utf-8 file names
Junio C Hamano
Re: git-svnimport
Johannes Schindelin
Re: [PATCH] Fix approxidate("never") to always return 0
A Large Angry SCM
Re: [RFC] origin link for cherry-pick and revert
Nicolas Pitre
[PATCH] diff: don't presume empty file when corresponding object is missing
linux-netdev
:
Arnaldo Carvalho de Melo
Re: [PATCH 06/37] dccp: Limit feature negotiation to connection setup phase
Gerrit Renker
[PATCH 1/5] dccp: Initialisation framework for feature negotiation
Mike Frysinger
Re: bridge netpoll support: mismatch between net core and bridge headers
Daniel Lezcano
getsockopt(TCP_DEFER_ACCEPT) value change
David Miller
Re: 2.6.27.18: bnx2/tg3: BUG: "scheduling while atomic" trying to ifenslave a seco...
git-commits-head
:
Linux Kernel Mailing List
ath9k_htc: Allocate URBs properly
Linux Kernel Mailing List
timer: Try to survive timer callback preempt_count leak
Linux Kernel Mailing List
powerpc/kexec: Add support for FSL-BookE
Linux Kernel Mailing List
V4L/DVB (8976): af9015: Add USB ID for AVerMedia A309
Linux Kernel Mailing List
ARM: 5670/1: bcmring: add default configuration for bcmring arch
openbsd-misc
:
Stephen J. Bevan
GRE over IPsec
Christophe Rioux
Implementation example of snmp
Darrin Chandler
Re: strange output on openbsd C code
Nick Holland
Re: booting openbsd on eee without cd-rom
Guido Tschakert
Re: what exactly is enc0?
Colocation donated by:
Syndicate