public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] New bind/unbingd uevents
@ 2017-07-20  0:24 Dmitry Torokhov
  2017-07-20  0:24 ` [PATCH v2 1/7] driver core: emit uevents when device is bound to a driver Dmitry Torokhov
                   ` (6 more replies)
  0 siblings, 7 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2017-07-20  0:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: htejun, linux-kernel, Guenter Roeck

Hi Greg,

Here is the v2 of bind/unbind uevent patch series.  The new bind/unbind
will allow triggering firmware update through udev, and the new device
sysfs API will cut down on some boilerplate code in drivers.

As you requested, I moved the new functions to device.h, in the process I
exported existing device_add_groups() and device_remove_groups() and called
the new functions devm_device_{add|remove}_group[s]() to get away from the
sysfs "rawness".

Below is also a patch to systemd to stop dropping the new attributes
(why they think they need to inspect and discard the data they do not
understand is beyond me).

Thanks,
Dmitry

V2:
- made device_{add|remove}_groups() public
- added device_{add|remove}_group() helpers
- the new devm APIs are moved into device.h and "sysfs" suffix dropped
- added 3 patches showing use in the drivers

V1: initial [re]post

Dmitry Torokhov (7):
  driver core: emit uevents when device is bound to a driver
  driver core: make device_{add|remove}_groups() public
  driver core: add device_{add|remove}_group() helpers
  driver core: add devm_device_add_group() and friends
  Input: gpio_keys - use devm_device_add_group() for attributes
  Input: synaptics_rmi4 - use devm_device_add_group() for attributes in F01
  Input: axp20x-pek - switch to using devm_device_add_group()

 drivers/base/base.h                |   5 --
 drivers/base/core.c                | 132 +++++++++++++++++++++++++++++++++++++
 drivers/base/dd.c                  |   4 ++
 drivers/input/keyboard/gpio_keys.c |  16 +----
 drivers/input/misc/axp20x-pek.c    |  18 +----
 drivers/input/rmi4/rmi_f01.c       |  11 +---
 include/linux/device.h             |  30 +++++++++
 include/linux/kobject.h            |   2 +
 lib/kobject_uevent.c               |   2 +
 9 files changed, 176 insertions(+), 44 deletions(-)

-- >8 --

>From 6d10e621578dffcca0ad785e4a73196aa25350f6 Mon Sep 17 00:00:00 2001
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: Mon, 17 Jul 2017 20:10:17 -0700
Subject: [PATCH] Add handling for bind/unbind actions

Newer kernels will emit uevents with "bind" and "unbind" actions. These
uevents will be issued when driver is bound to or unbound from a device.
"Bind" events are helpful when device requires a firmware to operate
properly, and driver is unable to create a child device before firmware
is properly loaded.

For some reason systemd validates actions and drops the ones it does not
know, instead of passing them on through as old udev did, so we need to
explicitly teach it about them.
---
 src/libsystemd/sd-device/device-internal.h | 2 ++
 src/libsystemd/sd-device/device-private.c  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/src/libsystemd/sd-device/device-internal.h b/src/libsystemd/sd-device/device-internal.h
index f4783deef..0505a2730 100644
--- a/src/libsystemd/sd-device/device-internal.h
+++ b/src/libsystemd/sd-device/device-internal.h
@@ -104,6 +104,8 @@ typedef enum DeviceAction {
         DEVICE_ACTION_MOVE,
         DEVICE_ACTION_ONLINE,
         DEVICE_ACTION_OFFLINE,
+        DEVICE_ACTION_BIND,
+        DEVICE_ACTION_UNBIND,
         _DEVICE_ACTION_MAX,
         _DEVICE_ACTION_INVALID = -1,
 } DeviceAction;
diff --git a/src/libsystemd/sd-device/device-private.c b/src/libsystemd/sd-device/device-private.c
index b4cd676c1..8839c3266 100644
--- a/src/libsystemd/sd-device/device-private.c
+++ b/src/libsystemd/sd-device/device-private.c
@@ -466,6 +466,8 @@ static const char* const device_action_table[_DEVICE_ACTION_MAX] = {
         [DEVICE_ACTION_MOVE] = "move",
         [DEVICE_ACTION_ONLINE] = "online",
         [DEVICE_ACTION_OFFLINE] = "offline",
+        [DEVICE_ACTION_BIND] = "bind",
+        [DEVICE_ACTION_UNBIND] = "unbind",
 };
 
 DEFINE_STRING_TABLE_LOOKUP(device_action, DeviceAction);

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2017-09-30  8:13 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-20  0:24 [PATCH v2 0/7] New bind/unbingd uevents Dmitry Torokhov
2017-07-20  0:24 ` [PATCH v2 1/7] driver core: emit uevents when device is bound to a driver Dmitry Torokhov
2017-09-29 19:36   ` Dan Williams
2017-09-29 19:40     ` Ruhl, Michael J
2017-09-29 23:23       ` Dmitry Torokhov
2017-09-30  8:13         ` Greg Kroah-Hartman
2017-07-20  0:24 ` [PATCH v2 2/7] driver core: make device_{add|remove}_groups() public Dmitry Torokhov
2017-07-20  0:24 ` [PATCH v2 3/7] driver core: add device_{add|remove}_group() helpers Dmitry Torokhov
2017-07-20  0:24 ` [PATCH v2 4/7] driver core: add devm_device_add_group() and friends Dmitry Torokhov
2017-07-20  5:10   ` Greg Kroah-Hartman
2017-07-20  8:12     ` Dmitry Torokhov
2017-07-20  8:20       ` Greg Kroah-Hartman
2017-07-20 15:50         ` Dmitry Torokhov
2017-07-22 10:03           ` Greg Kroah-Hartman
2017-07-20  0:24 ` [PATCH v2 5/7] Input: gpio_keys - use devm_device_add_group() for attributes Dmitry Torokhov
2017-07-20  3:22   ` Guenter Roeck
2017-07-20  0:24 ` [PATCH v2 6/7] Input: synaptics_rmi4 - use devm_device_add_group() for attributes in F01 Dmitry Torokhov
2017-07-20  3:22   ` Guenter Roeck
2017-07-20  0:24 ` [PATCH v2 7/7] Input: axp20x-pek - switch to using devm_device_add_group() Dmitry Torokhov
2017-07-20  3:21   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox