From 07b11982e32b7727aaa4dd1519914321a82093aa Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Tue, 16 Oct 2018 10:15:02 +0100 Subject: [PATCH] zdev: Trigger generic_ccw devices on any kernel module loads. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Generic CCW device can use any driver, and the value of the driver is not known ahead of time. To avoid the race between loading and binding a kernel module, and devices added - retrigger generic-ccw devices on any kernel module load. Fixes: https://github.com/ibm-s390-tools/s390-tools/issues/37 Link: https://bugs.launchpad.net/ubuntu-z-systems/+bug/1794308 Closes: https://github.com/ibm-s390-tools/s390-tools/pull/45 Signed-off-by: Dimitri John Ledkov Acked-by: Peter Oberparleiter Signed-off-by: Jan Höppner --- zdev/include/ccw.h | 2 ++ zdev/src/generic_ccw.c | 1 + zdev/src/udev_ccw.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/zdev/include/ccw.h b/zdev/include/ccw.h index f578ab73..1042d2b5 100644 --- a/zdev/include/ccw.h +++ b/zdev/include/ccw.h @@ -62,10 +62,12 @@ struct ccw_devinfo { * ccw_subtype_data - CCW subtype specific information * @ccwdrv: The name of the CCW device driver for this subtype * @mod: The name of the main kernel module for this subtype + * @any_driver: If set, the exact driver for this subtype are not known */ struct ccw_subtype_data { const char *ccwdrv; const char *mod; + bool any_driver; }; extern struct attrib ccw_attr_online; diff --git a/zdev/src/generic_ccw.c b/zdev/src/generic_ccw.c index 1ec8a2a2..c7f144a7 100644 --- a/zdev/src/generic_ccw.c +++ b/zdev/src/generic_ccw.c @@ -29,6 +29,7 @@ static struct ccw_subtype_data generic_ccw_data = { .ccwdrv = NULL, .mod = NULL, + .any_driver = true, }; /* Check if there is a non-generic subtype in the CCW namespace that uses the diff --git a/zdev/src/udev_ccw.c b/zdev/src/udev_ccw.c index 8f17f747..f3df59fe 100644 --- a/zdev/src/udev_ccw.c +++ b/zdev/src/udev_ccw.c @@ -140,7 +140,7 @@ exit_code_t udev_ccw_write_device(struct device *dev, bool autoconf) { struct subtype *st = dev->subtype; struct ccw_subtype_data *data = st->data; - const char *type = st->name, *drv = data->ccwdrv, *id = dev->id; + const char *type = st->name, *drv = data->any_driver ? "*" : data->ccwdrv, *id = dev->id; struct device_state *state = autoconf ? &dev->autoconf : &dev->persistent; char *path, *cfg_label = NULL, *end_label = NULL;