From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Vojtech Pavlik <vojtech@suse.cz>
Cc: linux-kernel@vger.kernel.org
Subject: [patch 03/24] serio: add modalias
Date: Mon, 25 Jul 2005 00:34:52 -0500 [thread overview]
Message-ID: <20050725054530.929151000.dtor_core@ameritech.net> (raw)
In-Reply-To: 20050725053449.483098000.dtor_core@ameritech.net
[-- Attachment #1: serio-modalias.patch --]
[-- Type: text/plain, Size: 2905 bytes --]
Input: serio - add modalias attribute and environment variable to
simplify hotplug scripts.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/input/serio/serio.c | 42 ++++++++++++++++++++++++++----------------
1 files changed, 26 insertions(+), 16 deletions(-)
Index: work/drivers/input/serio/serio.c
===================================================================
--- work.orig/drivers/input/serio/serio.c
+++ work/drivers/input/serio/serio.c
@@ -389,6 +389,14 @@ static ssize_t serio_show_description(st
return sprintf(buf, "%s\n", serio->name);
}
+static ssize_t serio_show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct serio *serio = to_serio_port(dev);
+
+ return sprintf(buf, "serio:ty%02Xpr%02Xid%02Xex%02X\n",
+ serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
+}
+
static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf)
{
struct serio *serio = to_serio_port(dev);
@@ -487,6 +495,7 @@ static ssize_t serio_set_bind_mode(struc
static struct device_attribute serio_device_attrs[] = {
__ATTR(description, S_IRUGO, serio_show_description, NULL),
+ __ATTR(modalias, S_IRUGO, serio_show_modalias, NULL),
__ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver),
__ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode),
__ATTR_NULL
@@ -785,36 +794,37 @@ static int serio_bus_match(struct device
#ifdef CONFIG_HOTPLUG
-#define PUT_ENVP(fmt, val) \
-do { \
- envp[i++] = buffer; \
- length += snprintf(buffer, buffer_size - length, fmt, val); \
- if (buffer_size - length <= 0 || i >= num_envp) \
- return -ENOMEM; \
- length++; \
- buffer += length; \
-} while (0)
+#define SERIO_ADD_HOTPLUG_VAR(fmt, val...) \
+ do { \
+ int err = add_hotplug_env_var(envp, num_envp, &i, \
+ buffer, buffer_size, &len, \
+ fmt, val); \
+ if (err) \
+ return err; \
+ } while (0)
+
static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
{
struct serio *serio;
int i = 0;
- int length = 0;
+ int len = 0;
if (!dev)
return -ENODEV;
serio = to_serio_port(dev);
- PUT_ENVP("SERIO_TYPE=%02x", serio->id.type);
- PUT_ENVP("SERIO_PROTO=%02x", serio->id.proto);
- PUT_ENVP("SERIO_ID=%02x", serio->id.id);
- PUT_ENVP("SERIO_EXTRA=%02x", serio->id.extra);
-
+ SERIO_ADD_HOTPLUG_VAR("SERIO_TYPE=%02x", serio->id.type);
+ SERIO_ADD_HOTPLUG_VAR("SERIO_PROTO=%02x", serio->id.proto);
+ SERIO_ADD_HOTPLUG_VAR("SERIO_ID=%02x", serio->id.id);
+ SERIO_ADD_HOTPLUG_VAR("SERIO_EXTRA=%02x", serio->id.extra);
+ SERIO_ADD_HOTPLUG_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X",
+ serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
envp[i] = NULL;
return 0;
}
-#undef PUT_ENVP
+#undef SERIO_ADD_HOTPLUG_VAR
#else
next prev parent reply other threads:[~2005-07-25 5:53 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-25 5:34 [patch 00/24] Input patches for 2.6.13 Dmitry Torokhov
2005-07-25 5:34 ` [patch 01/24] uinput: formatting, cleanup Dmitry Torokhov
2005-07-25 5:34 ` [patch 02/24] uinput: use completions Dmitry Torokhov
2005-07-25 5:34 ` Dmitry Torokhov [this message]
2005-07-25 5:34 ` [patch 04/24] Acecad: small cleanup Dmitry Torokhov
2005-07-25 5:34 ` [patch 05/24] Add usb_to_input_id Dmitry Torokhov
2005-07-25 5:34 ` [patch 06/24] sonypi: make sure input_work is not running when unloading Dmitry Torokhov
2005-07-25 5:34 ` [patch 07/24] input: rearrange procfs code Dmitry Torokhov
2005-07-25 5:34 ` [patch 08/24] input: make name, phys and uniq const char Dmitry Torokhov
2005-07-25 5:34 ` [patch 09/24] input.c section fix Dmitry Torokhov
2005-07-25 5:34 ` [patch 10/24] serio_raw: link misc device and serio port Dmitry Torokhov
2005-07-25 5:35 ` [patch 11/24] serio_raw - fix Kconfig help Dmitry Torokhov
2005-07-25 5:35 ` [patch 12/24] i8042 - add Alienware Sentia to NOMUX blacklist Dmitry Torokhov
2005-07-25 5:35 ` [patch 13/24] i8042 - add Fujitsu T3010 " Dmitry Torokhov
2005-07-25 5:35 ` [patch 14/24] synaptics - limit rate on Toshiba Dynabooks Dmitry Torokhov
2005-07-25 5:35 ` [patch 15/24] ALPS: Fix resume for DualPoints Dmitry Torokhov
2005-07-25 5:35 ` [patch 16/24] ALPS: fix enabling tapping mode Dmitry Torokhov
2005-07-25 5:35 ` [patch 17/24] HID: Add a quirk for Aashima gamepad Dmitry Torokhov
2005-07-25 5:35 ` [patch 18/24] joydev - remove MSECS macro Dmitry Torokhov
2005-07-25 5:35 ` [patch 19/24] elo - fix help in Kconfig Dmitry Torokhov
2005-07-25 5:35 ` [patch 20/24] HID - only report events coming from interrupts to hiddev Dmitry Torokhov
2005-07-25 5:35 ` [patch 21/24] psmouse: wheel mice always have middle button Dmitry Torokhov
2005-07-25 5:35 ` [patch 22/24] i8042 - dont use negation in i8042_command() Dmitry Torokhov
2005-07-25 5:35 ` [patch 23/24] Input - check keycodesize when adjusting keymaps Dmitry Torokhov
2005-07-25 5:35 ` [patch 24/24] Synaptics - fix setting packet size on passthrough port Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050725054530.929151000.dtor_core@ameritech.net \
--to=dtor_core@ameritech.net \
--cc=linux-kernel@vger.kernel.org \
--cc=vojtech@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox