driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/10] staging: most: move core module out of staging
@ 2020-01-23 15:38 Christian Gromm
  2020-01-23 15:38 ` [PATCH v4 01/10] staging: most: remove device from interface structure Christian Gromm
                   ` (9 more replies)
  0 siblings, 10 replies; 17+ messages in thread
From: Christian Gromm @ 2020-01-23 15:38 UTC (permalink / raw)
  To: gregkh; +Cc: Christian Gromm, driverdev-devel

The MOST driver was pushed to the staging area with kernel 4.3. Since then
it has encountered many refinements by the community and should be ready
for an upstream audit and to be moved out of the staging area. Since the
driver consists of multiple modules the core module is about to go first
and the other modules will follow subsequently. This patchset executes the
necessary steps to move the core module out of staging.

v2:
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        - use -M option to create patches
v3:
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        - fix date range in comment section of core.c
        - move code to free up memory to release funtions
        - remove noisy log messages
        - use dev_* functions for logging
v4:
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
	- change owner of struct device that is registered with kernel's
	  device/driver model
	- fix linked list race condition
	- fix logging behaviour
	- fix possible NULL pointer dereference

Christian Gromm (10):
  staging: most: remove device from interface structure
  staging: most: core: drop device reference
  staging: most: remove struct device core driver
  staging: most: core: remove container struct
  staging: most: core: fix logging messages
  staging: next: configfs: fix release link
  staging: most: usb: check for NULL device
  staging: most: move core files out of the staging area
  staging: most: Documentation: update ABI description
  staging: most: Documentation: move ABI description files out of
    staging area

 .../ABI/testing/configfs-most                      |   8 -
 .../ABI/testing/sysfs-bus-most                     |  24 +--
 drivers/Kconfig                                    |   1 +
 drivers/Makefile                                   |   1 +
 drivers/most/Kconfig                               |  15 ++
 drivers/most/Makefile                              |   4 +
 drivers/{staging => }/most/configfs.c              |  28 +++-
 drivers/{staging => }/most/core.c                  | 164 +++++++++------------
 drivers/staging/most/Kconfig                       |   6 +-
 drivers/staging/most/Makefile                      |   5 -
 drivers/staging/most/cdev/cdev.c                   |   2 +-
 drivers/staging/most/dim2/dim2.c                   |   5 +-
 drivers/staging/most/i2c/i2c.c                     |   2 +-
 drivers/staging/most/net/net.c                     |   2 +-
 drivers/staging/most/sound/sound.c                 |   2 +-
 drivers/staging/most/usb/usb.c                     |  25 +++-
 drivers/staging/most/video/video.c                 |   2 +-
 {drivers/staging/most => include/linux}/most.h     |   4 +-
 18 files changed, 145 insertions(+), 155 deletions(-)
 rename drivers/staging/most/Documentation/ABI/configfs-most.txt => Documentation/ABI/testing/configfs-most (94%)
 rename drivers/staging/most/Documentation/ABI/sysfs-bus-most.txt => Documentation/ABI/testing/sysfs-bus-most (92%)
 create mode 100644 drivers/most/Kconfig
 create mode 100644 drivers/most/Makefile
 rename drivers/{staging => }/most/configfs.c (98%)
 rename drivers/{staging => }/most/core.c (91%)
 rename {drivers/staging/most => include/linux}/most.h (99%)

-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v4 01/10] staging: most: remove device from interface structure
  2020-01-23 15:38 [PATCH v4 00/10] staging: most: move core module out of staging Christian Gromm
@ 2020-01-23 15:38 ` Christian Gromm
  2020-01-23 18:18   ` Greg KH
  2020-01-23 15:38 ` [PATCH v4 02/10] staging: most: core: drop device reference Christian Gromm
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Christian Gromm @ 2020-01-23 15:38 UTC (permalink / raw)
  To: gregkh; +Cc: Christian Gromm, driverdev-devel

This patch makes the adapter drivers use their own device structures
when registering a most interface with the core module.
With this the module that actually operates the physical device is the
owner of the device.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
v4:
	This patch has beed added to the series

 drivers/staging/most/core.c      | 45 ++++++++++++++++++----------------------
 drivers/staging/most/dim2/dim2.c |  2 +-
 drivers/staging/most/most.h      |  4 +---
 drivers/staging/most/usb/usb.c   | 20 ++++++++++++++----
 4 files changed, 38 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 5772f89..d907f93 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -401,7 +401,7 @@ static ssize_t description_show(struct device *dev,
 				struct device_attribute *attr,
 				char *buf)
 {
-	struct most_interface *iface = to_most_interface(dev);
+	struct most_interface *iface = dev_get_drvdata(dev);
 
 	return snprintf(buf, PAGE_SIZE, "%s\n", iface->description);
 }
@@ -410,7 +410,7 @@ static ssize_t interface_show(struct device *dev,
 			      struct device_attribute *attr,
 			      char *buf)
 {
-	struct most_interface *iface = to_most_interface(dev);
+	struct most_interface *iface = dev_get_drvdata(dev);
 
 	switch (iface->interface) {
 	case ITYPE_LOOPBACK:
@@ -475,7 +475,7 @@ static int print_links(struct device *dev, void *data)
 	int offs = d->offs;
 	char *buf = d->buf;
 	struct most_channel *c;
-	struct most_interface *iface = to_most_interface(dev);
+	struct most_interface *iface = dev_get_drvdata(dev);
 
 	list_for_each_entry(c, &iface->p->channel_list, list) {
 		if (c->pipe0.comp) {
@@ -483,7 +483,7 @@ static int print_links(struct device *dev, void *data)
 					 PAGE_SIZE - offs,
 					 "%s:%s:%s\n",
 					 c->pipe0.comp->name,
-					 dev_name(&iface->dev),
+					 dev_name(iface->dev),
 					 dev_name(&c->dev));
 		}
 		if (c->pipe1.comp) {
@@ -491,7 +491,7 @@ static int print_links(struct device *dev, void *data)
 					 PAGE_SIZE - offs,
 					 "%s:%s:%s\n",
 					 c->pipe1.comp->name,
-					 dev_name(&iface->dev),
+					 dev_name(iface->dev),
 					 dev_name(&c->dev));
 		}
 	}
@@ -533,7 +533,7 @@ static struct most_channel *get_channel(char *mdev, char *mdev_ch)
 	dev = bus_find_device_by_name(&mc.bus, NULL, mdev);
 	if (!dev)
 		return NULL;
-	iface = to_most_interface(dev);
+	iface = dev_get_drvdata(dev);
 	list_for_each_entry_safe(c, tmp, &iface->p->channel_list, list) {
 		if (!strcmp(dev_name(&c->dev), mdev_ch))
 			return c;
@@ -1231,7 +1231,7 @@ static int disconnect_channels(struct device *dev, void *data)
 	struct most_channel *c, *tmp;
 	struct most_component *comp = data;
 
-	iface = to_most_interface(dev);
+	iface = dev_get_drvdata(dev);
 	list_for_each_entry_safe(c, tmp, &iface->p->channel_list, list) {
 		if (c->pipe0.comp == comp || c->pipe1.comp == comp)
 			comp->disconnect_channel(c->iface, c->channel_id);
@@ -1260,14 +1260,11 @@ int most_deregister_component(struct most_component *comp)
 }
 EXPORT_SYMBOL_GPL(most_deregister_component);
 
-static void release_interface(struct device *dev)
-{
-	dev_info(&mc.dev, "releasing interface dev %s...\n", dev_name(dev));
-}
-
 static void release_channel(struct device *dev)
 {
-	dev_info(&mc.dev, "releasing channel dev %s...\n", dev_name(dev));
+	struct most_channel *c = to_channel(dev);
+
+	kfree(c);
 }
 
 /**
@@ -1304,14 +1301,14 @@ int most_register_interface(struct most_interface *iface)
 	INIT_LIST_HEAD(&iface->p->channel_list);
 	iface->p->dev_id = id;
 	strscpy(iface->p->name, iface->description, sizeof(iface->p->name));
-	iface->dev.init_name = iface->p->name;
-	iface->dev.bus = &mc.bus;
-	iface->dev.parent = &mc.dev;
-	iface->dev.groups = interface_attr_groups;
-	iface->dev.release = release_interface;
-	if (device_register(&iface->dev)) {
+	iface->dev->bus = &mc.bus;
+	iface->dev->parent = &mc.dev;
+	iface->dev->groups = interface_attr_groups;
+	dev_set_drvdata(iface->dev, iface);
+	if (device_register(iface->dev)) {
 		dev_err(&mc.dev, "registering iface->dev failed\n");
 		kfree(iface->p);
+		put_device(iface->dev);
 		ida_simple_remove(&mdev_id, id);
 		return -ENOMEM;
 	}
@@ -1327,7 +1324,7 @@ int most_register_interface(struct most_interface *iface)
 		else
 			snprintf(c->name, STRING_SIZE, "%s", name_suffix);
 		c->dev.init_name = c->name;
-		c->dev.parent = &iface->dev;
+		c->dev.parent = iface->dev;
 		c->dev.groups = channel_attr_groups;
 		c->dev.release = release_channel;
 		iface->p->channel[i] = c;
@@ -1361,16 +1358,15 @@ int most_register_interface(struct most_interface *iface)
 	return 0;
 
 err_free_most_channel:
-	kfree(c);
+	put_device(&c->dev);
 
 err_free_resources:
 	while (i > 0) {
 		c = iface->p->channel[--i];
 		device_unregister(&c->dev);
-		kfree(c);
 	}
 	kfree(iface->p);
-	device_unregister(&iface->dev);
+	device_unregister(iface->dev);
 	ida_simple_remove(&mdev_id, id);
 	return -ENOMEM;
 }
@@ -1400,12 +1396,11 @@ void most_deregister_interface(struct most_interface *iface)
 		c->pipe1.comp = NULL;
 		list_del(&c->list);
 		device_unregister(&c->dev);
-		kfree(c);
 	}
 
 	ida_simple_remove(&mdev_id, iface->p->dev_id);
 	kfree(iface->p);
-	device_unregister(&iface->dev);
+	device_unregister(iface->dev);
 }
 EXPORT_SYMBOL_GPL(most_deregister_interface);
 
diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index 9eb10fc..3be21f33 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -854,8 +854,8 @@ static int dim2_probe(struct platform_device *pdev)
 	dev->most_iface.poison_channel = poison_channel;
 	dev->most_iface.request_netinfo = request_netinfo;
 	dev->most_iface.driver_dev = &pdev->dev;
+	dev->most_iface.dev = &dev->dev;
 	dev->dev.init_name = "dim2_state";
-	dev->dev.parent = &dev->most_iface.dev;
 
 	ret = most_register_interface(&dev->most_iface);
 	if (ret) {
diff --git a/drivers/staging/most/most.h b/drivers/staging/most/most.h
index d93c6ce..232e01b 100644
--- a/drivers/staging/most/most.h
+++ b/drivers/staging/most/most.h
@@ -229,7 +229,7 @@ struct mbo {
  * @priv Private field used by mostcore to store context information.
  */
 struct most_interface {
-	struct device dev;
+	struct device *dev;
 	struct device *driver_dev;
 	struct module *mod;
 	enum most_interface_type interface;
@@ -251,8 +251,6 @@ struct most_interface {
 	struct interface_private *p;
 };
 
-#define to_most_interface(d) container_of(d, struct most_interface, dev)
-
 /**
  * struct most_component - identifies a loadable component for the mostcore
  * @list: list_head
diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index 491b38e..3c8ae17 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -101,6 +101,7 @@ struct clear_hold_work {
  * @poll_work_obj: work for polling link status
  */
 struct most_dev {
+	struct device dev;
 	struct usb_device *usb_device;
 	struct most_interface iface;
 	struct most_channel_capability *cap;
@@ -122,6 +123,7 @@ struct most_dev {
 };
 
 #define to_mdev(d) container_of(d, struct most_dev, iface)
+#define to_mdev_from_dev(d) container_of(d, struct most_dev, dev)
 #define to_mdev_from_work(w) container_of(w, struct most_dev, poll_work_obj)
 
 static void wq_clear_halt(struct work_struct *wq_obj);
@@ -1022,6 +1024,12 @@ static void release_dci(struct device *dev)
 	kfree(dci);
 }
 
+static void release_mdev(struct device *dev)
+{
+	struct most_dev *mdev = to_mdev_from_dev(dev);
+
+	kfree(mdev);
+}
 /**
  * hdm_probe - probe function of USB device driver
  * @interface: Interface of the attached USB device
@@ -1060,6 +1068,7 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
 	mdev->link_stat_timer.expires = jiffies + (2 * HZ);
 
 	mdev->iface.mod = hdm_usb_fops.owner;
+	mdev->iface.dev = &mdev->dev;
 	mdev->iface.driver_dev = &interface->dev;
 	mdev->iface.interface = ITYPE_USB;
 	mdev->iface.configure = hdm_configure_channel;
@@ -1078,6 +1087,9 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
 		 usb_dev->config->desc.bConfigurationValue,
 		 usb_iface_desc->desc.bInterfaceNumber);
 
+	mdev->dev.init_name = mdev->description;
+	mdev->dev.parent = &interface->dev;
+	mdev->dev.release = release_mdev;
 	mdev->conf = kcalloc(num_endpoints, sizeof(*mdev->conf), GFP_KERNEL);
 	if (!mdev->conf)
 		goto err_free_mdev;
@@ -1151,7 +1163,7 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
 		}
 
 		mdev->dci->dev.init_name = "dci";
-		mdev->dci->dev.parent = &mdev->iface.dev;
+		mdev->dci->dev.parent = get_device(mdev->iface.dev);
 		mdev->dci->dev.groups = dci_attr_groups;
 		mdev->dci->dev.release = release_dci;
 		if (device_register(&mdev->dci->dev)) {
@@ -1165,7 +1177,7 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
 	mutex_unlock(&mdev->io_mutex);
 	return 0;
 err_free_dci:
-	kfree(mdev->dci);
+	put_device(&mdev->dci->dev);
 err_free_busy_urbs:
 	kfree(mdev->busy_urbs);
 err_free_ep_address:
@@ -1175,7 +1187,7 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
 err_free_conf:
 	kfree(mdev->conf);
 err_free_mdev:
-	kfree(mdev);
+	put_device(&mdev->dev);
 err_out_of_memory:
 	if (ret == 0 || ret == -ENOMEM) {
 		ret = -ENOMEM;
@@ -1212,7 +1224,7 @@ static void hdm_disconnect(struct usb_interface *interface)
 	kfree(mdev->cap);
 	kfree(mdev->conf);
 	kfree(mdev->ep_address);
-	kfree(mdev);
+	put_device(&mdev->dev);
 }
 
 static struct usb_driver hdm_usb = {
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v4 02/10] staging: most: core: drop device reference
  2020-01-23 15:38 [PATCH v4 00/10] staging: most: move core module out of staging Christian Gromm
  2020-01-23 15:38 ` [PATCH v4 01/10] staging: most: remove device from interface structure Christian Gromm
@ 2020-01-23 15:38 ` Christian Gromm
  2020-01-23 15:38 ` [PATCH v4 03/10] staging: most: remove struct device core driver Christian Gromm
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Christian Gromm @ 2020-01-23 15:38 UTC (permalink / raw)
  To: gregkh; +Cc: Christian Gromm, driverdev-devel

This patch drops the device reference added by function
bus_find_device_by_name.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
v4:
	This patch has beed added to the series

 drivers/staging/most/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index d907f93..84d4f52 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -533,6 +533,7 @@ static struct most_channel *get_channel(char *mdev, char *mdev_ch)
 	dev = bus_find_device_by_name(&mc.bus, NULL, mdev);
 	if (!dev)
 		return NULL;
+	put_device(dev);
 	iface = dev_get_drvdata(dev);
 	list_for_each_entry_safe(c, tmp, &iface->p->channel_list, list) {
 		if (!strcmp(dev_name(&c->dev), mdev_ch))
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v4 03/10] staging: most: remove struct device core driver
  2020-01-23 15:38 [PATCH v4 00/10] staging: most: move core module out of staging Christian Gromm
  2020-01-23 15:38 ` [PATCH v4 01/10] staging: most: remove device from interface structure Christian Gromm
  2020-01-23 15:38 ` [PATCH v4 02/10] staging: most: core: drop device reference Christian Gromm
@ 2020-01-23 15:38 ` Christian Gromm
  2020-01-23 15:38 ` [PATCH v4 04/10] staging: most: core: remove container struct Christian Gromm
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Christian Gromm @ 2020-01-23 15:38 UTC (permalink / raw)
  To: gregkh; +Cc: Christian Gromm, driverdev-devel

This patch removes the device from the MOST core driver and uses the
device from the adapter driver.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
v4:
	This patch has been added to the series

 drivers/staging/most/core.c      | 52 ++++++++++++++--------------------------
 drivers/staging/most/dim2/dim2.c |  1 +
 2 files changed, 19 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 84d4f52..a17ea4c 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -29,7 +29,6 @@ static struct ida mdev_id;
 static int dummy_num_buffers;
 
 static struct mostcore {
-	struct device dev;
 	struct device_driver drv;
 	struct bus_type bus;
 	struct list_head comp_list;
@@ -150,7 +149,7 @@ static void flush_channel_fifos(struct most_channel *c)
 	spin_unlock_irqrestore(&c->fifo_lock, hf_flags);
 
 	if (unlikely((!list_empty(&c->fifo) || !list_empty(&c->halt_fifo))))
-		dev_warn(&mc.dev, "fifo | trash fifo not empty\n");
+		dev_warn(&c->dev, "fifo | trash fifo not empty\n");
 }
 
 /**
@@ -623,7 +622,7 @@ int most_set_cfg_datatype(char *mdev, char *mdev_ch, char *buf)
 	}
 
 	if (i == ARRAY_SIZE(ch_data_type))
-		dev_warn(&mc.dev, "invalid attribute settings\n");
+		dev_warn(&c->dev, "invalid attribute settings\n");
 	return 0;
 }
 
@@ -642,7 +641,7 @@ int most_set_cfg_direction(char *mdev, char *mdev_ch, char *buf)
 	} else if (!strcmp(buf, "tx")) {
 		c->cfg.direction = MOST_CH_TX;
 	} else {
-		dev_err(&mc.dev, "Invalid direction\n");
+		dev_err(&c->dev, "Invalid direction\n");
 		return -ENODATA;
 	}
 	return 0;
@@ -795,7 +794,7 @@ static int hdm_enqueue_thread(void *data)
 		mutex_unlock(&c->nq_mutex);
 
 		if (unlikely(ret)) {
-			dev_err(&mc.dev, "hdm enqueue failed\n");
+			dev_err(&c->dev, "hdm enqueue failed\n");
 			nq_hdm_mbo(mbo);
 			c->hdm_enqueue_task = NULL;
 			return 0;
@@ -942,7 +941,7 @@ static void most_write_completion(struct mbo *mbo)
 
 	c = mbo->context;
 	if (mbo->status == MBO_E_INVAL)
-		dev_warn(&mc.dev, "Tx MBO status: invalid\n");
+		dev_warn(&c->dev, "Tx MBO status: invalid\n");
 	if (unlikely(c->is_poisoned || (mbo->status == MBO_E_CLOSE)))
 		trash_mbo(mbo);
 	else
@@ -1101,14 +1100,14 @@ int most_start_channel(struct most_interface *iface, int id,
 		goto out; /* already started by another component */
 
 	if (!try_module_get(iface->mod)) {
-		dev_err(&mc.dev, "failed to acquire HDM lock\n");
+		dev_err(&c->dev, "failed to acquire HDM lock\n");
 		mutex_unlock(&c->start_mutex);
 		return -ENOLCK;
 	}
 
 	c->cfg.extra_len = 0;
 	if (c->iface->configure(c->iface, c->channel_id, &c->cfg)) {
-		dev_err(&mc.dev, "channel configuration failed. Go check settings...\n");
+		dev_err(&c->dev, "channel configuration failed. Go check settings...\n");
 		ret = -EINVAL;
 		goto err_put_module;
 	}
@@ -1162,7 +1161,7 @@ int most_stop_channel(struct most_interface *iface, int id,
 	struct most_channel *c;
 
 	if (unlikely((!iface) || (id >= iface->num_channels) || (id < 0))) {
-		dev_err(&mc.dev, "Bad interface or index out of range\n");
+		pr_err("Bad interface or index out of range\n");
 		return -EINVAL;
 	}
 	c = iface->p->channel[id];
@@ -1182,7 +1181,7 @@ int most_stop_channel(struct most_interface *iface, int id,
 
 	c->is_poisoned = true;
 	if (c->iface->poison_channel(c->iface, c->channel_id)) {
-		dev_err(&mc.dev, "Cannot stop channel %d of mdev %s\n", c->channel_id,
+		dev_err(&c->dev, "Cannot stop channel %d of mdev %s\n", c->channel_id,
 			c->iface->description);
 		mutex_unlock(&c->start_mutex);
 		return -EAGAIN;
@@ -1192,7 +1191,7 @@ int most_stop_channel(struct most_interface *iface, int id,
 
 #ifdef CMPL_INTERRUPTIBLE
 	if (wait_for_completion_interruptible(&c->cleanup)) {
-		dev_err(&mc.dev, "Interrupted while clean up ch %d\n", c->channel_id);
+		dev_err(&c->dev, "Interrupted while clean up ch %d\n", c->channel_id);
 		mutex_unlock(&c->start_mutex);
 		return -EINTR;
 	}
@@ -1218,7 +1217,7 @@ EXPORT_SYMBOL_GPL(most_stop_channel);
 int most_register_component(struct most_component *comp)
 {
 	if (!comp) {
-		dev_err(&mc.dev, "Bad component\n");
+		pr_err("Bad component\n");
 		return -EINVAL;
 	}
 	list_add_tail(&comp->list, &mc.comp_list);
@@ -1251,7 +1250,7 @@ static int disconnect_channels(struct device *dev, void *data)
 int most_deregister_component(struct most_component *comp)
 {
 	if (!comp) {
-		dev_err(&mc.dev, "Bad component\n");
+		pr_err("Bad component\n");
 		return -EINVAL;
 	}
 
@@ -1283,13 +1282,13 @@ int most_register_interface(struct most_interface *iface)
 
 	if (!iface || !iface->enqueue || !iface->configure ||
 	    !iface->poison_channel || (iface->num_channels > MAX_CHANNELS)) {
-		dev_err(&mc.dev, "Bad interface or channel overflow\n");
+		dev_err(iface->dev, "Bad interface or channel overflow\n");
 		return -EINVAL;
 	}
 
 	id = ida_simple_get(&mdev_id, 0, 0, GFP_KERNEL);
 	if (id < 0) {
-		dev_err(&mc.dev, "Failed to alloc mdev ID\n");
+		dev_err(iface->dev, "Failed to alloc mdev ID\n");
 		return id;
 	}
 
@@ -1303,11 +1302,10 @@ int most_register_interface(struct most_interface *iface)
 	iface->p->dev_id = id;
 	strscpy(iface->p->name, iface->description, sizeof(iface->p->name));
 	iface->dev->bus = &mc.bus;
-	iface->dev->parent = &mc.dev;
 	iface->dev->groups = interface_attr_groups;
 	dev_set_drvdata(iface->dev, iface);
 	if (device_register(iface->dev)) {
-		dev_err(&mc.dev, "registering iface->dev failed\n");
+		dev_err(iface->dev, "registering iface->dev failed\n");
 		kfree(iface->p);
 		put_device(iface->dev);
 		ida_simple_remove(&mdev_id, id);
@@ -1351,7 +1349,7 @@ int most_register_interface(struct most_interface *iface)
 		mutex_init(&c->nq_mutex);
 		list_add_tail(&c->list, &iface->p->channel_list);
 		if (device_register(&c->dev)) {
-			dev_err(&mc.dev, "registering c->dev failed\n");
+			dev_err(&c->dev, "registering c->dev failed\n");
 			goto err_free_most_channel;
 		}
 	}
@@ -1451,11 +1449,6 @@ void most_resume_enqueue(struct most_interface *iface, int id)
 }
 EXPORT_SYMBOL_GPL(most_resume_enqueue);
 
-static void release_most_sub(struct device *dev)
-{
-	dev_info(&mc.dev, "releasing most_subsystem\n");
-}
-
 static int __init most_init(void)
 {
 	int err;
@@ -1471,25 +1464,17 @@ static int __init most_init(void)
 
 	err = bus_register(&mc.bus);
 	if (err) {
-		dev_err(&mc.dev, "Cannot register most bus\n");
+		pr_err("Cannot register most bus\n");
 		return err;
 	}
 	err = driver_register(&mc.drv);
 	if (err) {
-		dev_err(&mc.dev, "Cannot register core driver\n");
+		pr_err("Cannot register core driver\n");
 		goto err_unregister_bus;
 	}
-	mc.dev.init_name = "most_bus";
-	mc.dev.release = release_most_sub;
-	if (device_register(&mc.dev)) {
-		err = -ENOMEM;
-		goto err_unregister_driver;
-	}
 	configfs_init();
 	return 0;
 
-err_unregister_driver:
-	driver_unregister(&mc.drv);
 err_unregister_bus:
 	bus_unregister(&mc.bus);
 	return err;
@@ -1497,7 +1482,6 @@ static int __init most_init(void)
 
 static void __exit most_exit(void)
 {
-	device_unregister(&mc.dev);
 	driver_unregister(&mc.drv);
 	bus_unregister(&mc.bus);
 	ida_destroy(&mdev_id);
diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index 3be21f33..987a91d 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -856,6 +856,7 @@ static int dim2_probe(struct platform_device *pdev)
 	dev->most_iface.driver_dev = &pdev->dev;
 	dev->most_iface.dev = &dev->dev;
 	dev->dev.init_name = "dim2_state";
+	dev->dev.parent = &pdev->dev;
 
 	ret = most_register_interface(&dev->most_iface);
 	if (ret) {
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v4 04/10] staging: most: core: remove container struct
  2020-01-23 15:38 [PATCH v4 00/10] staging: most: move core module out of staging Christian Gromm
                   ` (2 preceding siblings ...)
  2020-01-23 15:38 ` [PATCH v4 03/10] staging: most: remove struct device core driver Christian Gromm
@ 2020-01-23 15:38 ` Christian Gromm
  2020-01-23 15:38 ` [PATCH v4 05/10] staging: most: core: fix logging messages Christian Gromm
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Christian Gromm @ 2020-01-23 15:38 UTC (permalink / raw)
  To: gregkh; +Cc: Christian Gromm, driverdev-devel

This patch declares and initializes the bus, bus driver and the
component list without a container struct, as it introduces an
unnecessary level of abstraction.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
v4:
	This patch has been added to the series

 drivers/staging/most/core.c | 66 ++++++++++++++++++++++-----------------------
 1 file changed, 32 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index a17ea4c..a59a35c5 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -27,14 +27,7 @@
 
 static struct ida mdev_id;
 static int dummy_num_buffers;
-
-static struct mostcore {
-	struct device_driver drv;
-	struct bus_type bus;
-	struct list_head comp_list;
-} mc;
-
-#define to_driver(d) container_of(d, struct mostcore, drv)
+static struct list_head comp_list;
 
 struct pipe {
 	struct most_component *comp;
@@ -456,7 +449,7 @@ static struct most_component *match_component(char *name)
 {
 	struct most_component *comp;
 
-	list_for_each_entry(comp, &mc.comp_list, list) {
+	list_for_each_entry(comp, &comp_list, list) {
 		if (!strcmp(comp->name, name))
 			return comp;
 	}
@@ -498,11 +491,24 @@ static int print_links(struct device *dev, void *data)
 	return 0;
 }
 
+static int most_match(struct device *dev, struct device_driver *drv)
+{
+	if (!strcmp(dev_name(dev), "most"))
+		return 0;
+	else
+		return 1;
+}
+
+static struct bus_type mostbus = {
+	.name = "most",
+	.match = most_match,
+};
+
 static ssize_t links_show(struct device_driver *drv, char *buf)
 {
 	struct show_links_data d = { .buf = buf };
 
-	bus_for_each_dev(&mc.bus, NULL, &d, print_links);
+	bus_for_each_dev(&mostbus, NULL, &d, print_links);
 	return d.offs;
 }
 
@@ -511,7 +517,7 @@ static ssize_t components_show(struct device_driver *drv, char *buf)
 	struct most_component *comp;
 	int offs = 0;
 
-	list_for_each_entry(comp, &mc.comp_list, list) {
+	list_for_each_entry(comp, &comp_list, list) {
 		offs += snprintf(buf + offs, PAGE_SIZE - offs, "%s\n",
 				 comp->name);
 	}
@@ -529,7 +535,7 @@ static struct most_channel *get_channel(char *mdev, char *mdev_ch)
 	struct most_interface *iface;
 	struct most_channel *c, *tmp;
 
-	dev = bus_find_device_by_name(&mc.bus, NULL, mdev);
+	dev = bus_find_device_by_name(&mostbus, NULL, mdev);
 	if (!dev)
 		return NULL;
 	put_device(dev);
@@ -721,13 +727,11 @@ static const struct attribute_group *mc_attr_groups[] = {
 	NULL,
 };
 
-static int most_match(struct device *dev, struct device_driver *drv)
-{
-	if (!strcmp(dev_name(dev), "most"))
-		return 0;
-	else
-		return 1;
-}
+static struct device_driver mostbus_driver = {
+	.name = "most_core",
+	.bus = &mostbus,
+	.groups = mc_attr_groups,
+};
 
 static inline void trash_mbo(struct mbo *mbo)
 {
@@ -1220,7 +1224,7 @@ int most_register_component(struct most_component *comp)
 		pr_err("Bad component\n");
 		return -EINVAL;
 	}
-	list_add_tail(&comp->list, &mc.comp_list);
+	list_add_tail(&comp->list, &comp_list);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(most_register_component);
@@ -1254,7 +1258,7 @@ int most_deregister_component(struct most_component *comp)
 		return -EINVAL;
 	}
 
-	bus_for_each_dev(&mc.bus, NULL, comp, disconnect_channels);
+	bus_for_each_dev(&mostbus, NULL, comp, disconnect_channels);
 	list_del(&comp->list);
 	return 0;
 }
@@ -1301,7 +1305,7 @@ int most_register_interface(struct most_interface *iface)
 	INIT_LIST_HEAD(&iface->p->channel_list);
 	iface->p->dev_id = id;
 	strscpy(iface->p->name, iface->description, sizeof(iface->p->name));
-	iface->dev->bus = &mc.bus;
+	iface->dev->bus = &mostbus;
 	iface->dev->groups = interface_attr_groups;
 	dev_set_drvdata(iface->dev, iface);
 	if (device_register(iface->dev)) {
@@ -1453,21 +1457,15 @@ static int __init most_init(void)
 {
 	int err;
 
-	INIT_LIST_HEAD(&mc.comp_list);
+	INIT_LIST_HEAD(&comp_list);
 	ida_init(&mdev_id);
 
-	mc.bus.name = "most",
-	mc.bus.match = most_match,
-	mc.drv.name = "most_core",
-	mc.drv.bus = &mc.bus,
-	mc.drv.groups = mc_attr_groups;
-
-	err = bus_register(&mc.bus);
+	err = bus_register(&mostbus);
 	if (err) {
 		pr_err("Cannot register most bus\n");
 		return err;
 	}
-	err = driver_register(&mc.drv);
+	err = driver_register(&mostbus_driver);
 	if (err) {
 		pr_err("Cannot register core driver\n");
 		goto err_unregister_bus;
@@ -1476,14 +1474,14 @@ static int __init most_init(void)
 	return 0;
 
 err_unregister_bus:
-	bus_unregister(&mc.bus);
+	bus_unregister(&mostbus);
 	return err;
 }
 
 static void __exit most_exit(void)
 {
-	driver_unregister(&mc.drv);
-	bus_unregister(&mc.bus);
+	driver_unregister(&mostbus_driver);
+	bus_unregister(&mostbus);
 	ida_destroy(&mdev_id);
 }
 
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v4 05/10] staging: most: core: fix logging messages
  2020-01-23 15:38 [PATCH v4 00/10] staging: most: move core module out of staging Christian Gromm
                   ` (3 preceding siblings ...)
  2020-01-23 15:38 ` [PATCH v4 04/10] staging: most: core: remove container struct Christian Gromm
@ 2020-01-23 15:38 ` Christian Gromm
  2020-01-23 15:38 ` [PATCH v4 06/10] staging: next: configfs: fix release link Christian Gromm
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Christian Gromm @ 2020-01-23 15:38 UTC (permalink / raw)
  To: gregkh; +Cc: Christian Gromm, driverdev-devel

This patch fixes the module's logging messages.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
v4:
	This patch has beed added to the series

 drivers/staging/most/core.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index a59a35c5..13ab4eece 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -142,7 +142,7 @@ static void flush_channel_fifos(struct most_channel *c)
 	spin_unlock_irqrestore(&c->fifo_lock, hf_flags);
 
 	if (unlikely((!list_empty(&c->fifo) || !list_empty(&c->halt_fifo))))
-		dev_warn(&c->dev, "fifo | trash fifo not empty\n");
+		dev_warn(&c->dev, "Channel or trash fifo not empty\n");
 }
 
 /**
@@ -628,7 +628,7 @@ int most_set_cfg_datatype(char *mdev, char *mdev_ch, char *buf)
 	}
 
 	if (i == ARRAY_SIZE(ch_data_type))
-		dev_warn(&c->dev, "invalid attribute settings\n");
+		dev_warn(&c->dev, "Invalid attribute settings\n");
 	return 0;
 }
 
@@ -798,7 +798,7 @@ static int hdm_enqueue_thread(void *data)
 		mutex_unlock(&c->nq_mutex);
 
 		if (unlikely(ret)) {
-			dev_err(&c->dev, "hdm enqueue failed\n");
+			dev_err(&c->dev, "Buffer enqueue failed\n");
 			nq_hdm_mbo(mbo);
 			c->hdm_enqueue_task = NULL;
 			return 0;
@@ -925,7 +925,7 @@ static int arm_mbo_chain(struct most_channel *c, int dir,
 void most_submit_mbo(struct mbo *mbo)
 {
 	if (WARN_ONCE(!mbo || !mbo->context,
-		      "bad mbo or missing channel reference\n"))
+		      "Bad buffer or missing channel reference\n"))
 		return;
 
 	nq_hdm_mbo(mbo);
@@ -944,8 +944,6 @@ static void most_write_completion(struct mbo *mbo)
 	struct most_channel *c;
 
 	c = mbo->context;
-	if (mbo->status == MBO_E_INVAL)
-		dev_warn(&c->dev, "Tx MBO status: invalid\n");
 	if (unlikely(c->is_poisoned || (mbo->status == MBO_E_CLOSE)))
 		trash_mbo(mbo);
 	else
@@ -1104,14 +1102,14 @@ int most_start_channel(struct most_interface *iface, int id,
 		goto out; /* already started by another component */
 
 	if (!try_module_get(iface->mod)) {
-		dev_err(&c->dev, "failed to acquire HDM lock\n");
+		dev_err(&c->dev, "Failed to acquire HDM lock\n");
 		mutex_unlock(&c->start_mutex);
 		return -ENOLCK;
 	}
 
 	c->cfg.extra_len = 0;
 	if (c->iface->configure(c->iface, c->channel_id, &c->cfg)) {
-		dev_err(&c->dev, "channel configuration failed. Go check settings...\n");
+		dev_err(&c->dev, "Channel configuration failed. Go check settings...\n");
 		ret = -EINVAL;
 		goto err_put_module;
 	}
@@ -1185,7 +1183,7 @@ int most_stop_channel(struct most_interface *iface, int id,
 
 	c->is_poisoned = true;
 	if (c->iface->poison_channel(c->iface, c->channel_id)) {
-		dev_err(&c->dev, "Cannot stop channel %d of mdev %s\n", c->channel_id,
+		dev_err(&c->dev, "Failed to stop channel %d of interface %s\n", c->channel_id,
 			c->iface->description);
 		mutex_unlock(&c->start_mutex);
 		return -EAGAIN;
@@ -1195,7 +1193,7 @@ int most_stop_channel(struct most_interface *iface, int id,
 
 #ifdef CMPL_INTERRUPTIBLE
 	if (wait_for_completion_interruptible(&c->cleanup)) {
-		dev_err(&c->dev, "Interrupted while clean up ch %d\n", c->channel_id);
+		dev_err(&c->dev, "Interrupted while cleaning up channel %d\n", c->channel_id);
 		mutex_unlock(&c->start_mutex);
 		return -EINTR;
 	}
@@ -1292,7 +1290,7 @@ int most_register_interface(struct most_interface *iface)
 
 	id = ida_simple_get(&mdev_id, 0, 0, GFP_KERNEL);
 	if (id < 0) {
-		dev_err(iface->dev, "Failed to alloc mdev ID\n");
+		dev_err(iface->dev, "Failed to allocate device ID\n");
 		return id;
 	}
 
@@ -1309,7 +1307,7 @@ int most_register_interface(struct most_interface *iface)
 	iface->dev->groups = interface_attr_groups;
 	dev_set_drvdata(iface->dev, iface);
 	if (device_register(iface->dev)) {
-		dev_err(iface->dev, "registering iface->dev failed\n");
+		dev_err(iface->dev, "Failed to register interface device\n");
 		kfree(iface->p);
 		put_device(iface->dev);
 		ida_simple_remove(&mdev_id, id);
@@ -1353,7 +1351,7 @@ int most_register_interface(struct most_interface *iface)
 		mutex_init(&c->nq_mutex);
 		list_add_tail(&c->list, &iface->p->channel_list);
 		if (device_register(&c->dev)) {
-			dev_err(&c->dev, "registering c->dev failed\n");
+			dev_err(&c->dev, "Failed to register channel device\n");
 			goto err_free_most_channel;
 		}
 	}
@@ -1462,12 +1460,12 @@ static int __init most_init(void)
 
 	err = bus_register(&mostbus);
 	if (err) {
-		pr_err("Cannot register most bus\n");
+		pr_err("Failed to register most bus\n");
 		return err;
 	}
 	err = driver_register(&mostbus_driver);
 	if (err) {
-		pr_err("Cannot register core driver\n");
+		pr_err("Failed to register core driver\n");
 		goto err_unregister_bus;
 	}
 	configfs_init();
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v4 06/10] staging: next: configfs: fix release link
  2020-01-23 15:38 [PATCH v4 00/10] staging: most: move core module out of staging Christian Gromm
                   ` (4 preceding siblings ...)
  2020-01-23 15:38 ` [PATCH v4 05/10] staging: most: core: fix logging messages Christian Gromm
@ 2020-01-23 15:38 ` Christian Gromm
  2020-01-23 15:38 ` [PATCH v4 07/10] staging: most: usb: check for NULL device Christian Gromm
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Christian Gromm @ 2020-01-23 15:38 UTC (permalink / raw)
  To: gregkh; +Cc: Christian Gromm, driverdev-devel

The functions link_destroy and link_release are both deleting list items.
link_release, however, does not check whether a certain link has already
been deleted from the list by function link_destroy. By fixing this
this patch prevents a kernel crash when removing the configuration
directory of a link that already has been destroyed.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
v4:
	This patch has been added to the series

 drivers/staging/most/configfs.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/most/configfs.c b/drivers/staging/most/configfs.c
index 9818f6c..982d1a1 100644
--- a/drivers/staging/most/configfs.c
+++ b/drivers/staging/most/configfs.c
@@ -127,6 +127,8 @@ static ssize_t mdev_link_create_link_store(struct config_item *item,
 		return ret;
 	list_add_tail(&mdev_link->list, &mdev_link_list);
 	mdev_link->create_link = tmp;
+	mdev_link->destroy_link = false;
+
 	return count;
 }
 
@@ -142,13 +144,16 @@ static ssize_t mdev_link_destroy_link_store(struct config_item *item,
 		return ret;
 	if (!tmp)
 		return count;
-	mdev_link->destroy_link = tmp;
+
 	ret = most_remove_link(mdev_link->device, mdev_link->channel,
 			       mdev_link->comp);
 	if (ret)
 		return ret;
 	if (!list_empty(&mdev_link_list))
 		list_del(&mdev_link->list);
+
+	mdev_link->destroy_link = tmp;
+
 	return count;
 }
 
@@ -377,13 +382,20 @@ static void mdev_link_release(struct config_item *item)
 	struct mdev_link *mdev_link = to_mdev_link(item);
 	int ret;
 
-	if (!list_empty(&mdev_link_list)) {
-		ret = most_remove_link(mdev_link->device, mdev_link->channel,
-				       mdev_link->comp);
-		if (ret && (ret != -ENODEV))
-			pr_err("Removing link failed.\n");
-		list_del(&mdev_link->list);
+	if (mdev_link->destroy_link)
+		goto free_item;
+
+	ret = most_remove_link(mdev_link->device, mdev_link->channel,
+			       mdev_link->comp);
+	if (ret) {
+		pr_err("Removing link failed.\n");
+		goto free_item;
 	}
+
+	if (!list_empty(&mdev_link_list))
+		list_del(&mdev_link->list);
+
+free_item:
 	kfree(to_mdev_link(item));
 }
 
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v4 07/10] staging: most: usb: check for NULL device
  2020-01-23 15:38 [PATCH v4 00/10] staging: most: move core module out of staging Christian Gromm
                   ` (5 preceding siblings ...)
  2020-01-23 15:38 ` [PATCH v4 06/10] staging: next: configfs: fix release link Christian Gromm
@ 2020-01-23 15:38 ` Christian Gromm
  2020-01-23 15:38 ` [PATCH v4 08/10] staging: most: move core files out of the staging area Christian Gromm
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Christian Gromm @ 2020-01-23 15:38 UTC (permalink / raw)
  To: gregkh; +Cc: Christian Gromm, driverdev-devel

Check if the dci structer has been allocated before trying to release it.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
v3:
	This patch has beed added to the series.
v4:

 drivers/staging/most/usb/usb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index 3c8ae17..857f916 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -1217,7 +1217,8 @@ static void hdm_disconnect(struct usb_interface *interface)
 	del_timer_sync(&mdev->link_stat_timer);
 	cancel_work_sync(&mdev->poll_work_obj);
 
-	device_unregister(&mdev->dci->dev);
+	if (mdev->dci)
+		device_unregister(&mdev->dci->dev);
 	most_deregister_interface(&mdev->iface);
 
 	kfree(mdev->busy_urbs);
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v4 08/10] staging: most: move core files out of the staging area
  2020-01-23 15:38 [PATCH v4 00/10] staging: most: move core module out of staging Christian Gromm
                   ` (6 preceding siblings ...)
  2020-01-23 15:38 ` [PATCH v4 07/10] staging: most: usb: check for NULL device Christian Gromm
@ 2020-01-23 15:38 ` Christian Gromm
  2020-01-23 15:38 ` [PATCH v4 09/10] staging: most: Documentation: update ABI description Christian Gromm
  2020-01-23 15:38 ` [PATCH v4 10/10] staging: most: Documentation: move ABI description files out of staging area Christian Gromm
  9 siblings, 0 replies; 17+ messages in thread
From: Christian Gromm @ 2020-01-23 15:38 UTC (permalink / raw)
  To: gregkh; +Cc: Christian Gromm, driverdev-devel

This patch moves the core module to the /drivers/most directory
and makes all necessary changes in order to not break the build.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
v2:
v3:
v4:

 drivers/Kconfig                                |  1 +
 drivers/Makefile                               |  1 +
 drivers/most/Kconfig                           | 15 +++++++++++++++
 drivers/most/Makefile                          |  4 ++++
 drivers/{staging => }/most/configfs.c          |  2 +-
 drivers/{staging => }/most/core.c              |  2 +-
 drivers/staging/most/Kconfig                   |  6 +++---
 drivers/staging/most/Makefile                  |  5 -----
 drivers/staging/most/cdev/cdev.c               |  2 +-
 drivers/staging/most/dim2/dim2.c               |  2 +-
 drivers/staging/most/i2c/i2c.c                 |  2 +-
 drivers/staging/most/net/net.c                 |  2 +-
 drivers/staging/most/sound/sound.c             |  2 +-
 drivers/staging/most/usb/usb.c                 |  2 +-
 drivers/staging/most/video/video.c             |  2 +-
 {drivers/staging/most => include/linux}/most.h |  0
 16 files changed, 33 insertions(+), 17 deletions(-)
 create mode 100644 drivers/most/Kconfig
 create mode 100644 drivers/most/Makefile
 rename drivers/{staging => }/most/configfs.c (99%)
 rename drivers/{staging => }/most/core.c (99%)
 rename {drivers/staging/most => include/linux}/most.h (100%)

diff --git a/drivers/Kconfig b/drivers/Kconfig
index 8befa53..c739665 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -228,4 +228,5 @@ source "drivers/interconnect/Kconfig"
 
 source "drivers/counter/Kconfig"
 
+source "drivers/most/Kconfig"
 endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index aaef17c..0e1dcbc 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -186,3 +186,4 @@ obj-$(CONFIG_SIOX)		+= siox/
 obj-$(CONFIG_GNSS)		+= gnss/
 obj-$(CONFIG_INTERCONNECT)	+= interconnect/
 obj-$(CONFIG_COUNTER)		+= counter/
+obj-$(CONFIG_MOST)		+= most/
diff --git a/drivers/most/Kconfig b/drivers/most/Kconfig
new file mode 100644
index 0000000..58d7999
--- /dev/null
+++ b/drivers/most/Kconfig
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: GPL-2.0
+menuconfig MOST
+	tristate "MOST support"
+	depends on HAS_DMA && CONFIGFS_FS
+	default n
+	help
+	  Say Y here if you want to enable MOST support.
+	  This driver needs at least one additional component to enable the
+	  desired access from userspace (e.g. character devices) and one that
+	  matches the network controller's hardware interface (e.g. USB).
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called most_core.
+
+	  If in doubt, say N here.
diff --git a/drivers/most/Makefile b/drivers/most/Makefile
new file mode 100644
index 0000000..e810cd3
--- /dev/null
+++ b/drivers/most/Makefile
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_MOST) += most_core.o
+most_core-y :=	core.o \
+		configfs.o
diff --git a/drivers/staging/most/configfs.c b/drivers/most/configfs.c
similarity index 99%
rename from drivers/staging/most/configfs.c
rename to drivers/most/configfs.c
index 982d1a1..27b0c92 100644
--- a/drivers/staging/most/configfs.c
+++ b/drivers/most/configfs.c
@@ -10,7 +10,7 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/configfs.h>
-#include <most/most.h>
+#include <linux/most.h>
 
 #define MAX_STRING_SIZE 80
 
diff --git a/drivers/staging/most/core.c b/drivers/most/core.c
similarity index 99%
rename from drivers/staging/most/core.c
rename to drivers/most/core.c
index 13ab4eece..6a59e87 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/most/core.c
@@ -20,7 +20,7 @@
 #include <linux/kthread.h>
 #include <linux/dma-mapping.h>
 #include <linux/idr.h>
-#include <most/most.h>
+#include <linux/most.h>
 
 #define MAX_CHANNELS	64
 #define STRING_SIZE	80
diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig
index 6262eb2..c5a99f7 100644
--- a/drivers/staging/most/Kconfig
+++ b/drivers/staging/most/Kconfig
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
-menuconfig MOST
+menuconfig MOST_COMPONENTS
 	tristate "MOST support"
-	depends on HAS_DMA && CONFIGFS_FS
+	depends on HAS_DMA && CONFIGFS_FS && MOST
 	default n
 	help
 	  Say Y here if you want to enable MOST support.
@@ -16,7 +16,7 @@ menuconfig MOST
 
 
 
-if MOST
+if MOST_COMPONENTS
 
 source "drivers/staging/most/cdev/Kconfig"
 
diff --git a/drivers/staging/most/Makefile b/drivers/staging/most/Makefile
index 85ea5a4..3c446bb 100644
--- a/drivers/staging/most/Makefile
+++ b/drivers/staging/most/Makefile
@@ -1,9 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_MOST) += most_core.o
-most_core-y := core.o
-most_core-y += configfs.o
-ccflags-y += -I $(srctree)/drivers/staging/
-
 obj-$(CONFIG_MOST_CDEV)	+= cdev/
 obj-$(CONFIG_MOST_NET)	+= net/
 obj-$(CONFIG_MOST_SOUND)	+= sound/
diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c
index 59f346d..cc1e3de 100644
--- a/drivers/staging/most/cdev/cdev.c
+++ b/drivers/staging/most/cdev/cdev.c
@@ -16,7 +16,7 @@
 #include <linux/kfifo.h>
 #include <linux/uaccess.h>
 #include <linux/idr.h>
-#include <most/most.h>
+#include <linux/most.h>
 
 #define CHRDEV_REGION_SIZE 50
 
diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index 987a91d..6a9c23d 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -21,7 +21,7 @@
 #include <linux/sched.h>
 #include <linux/kthread.h>
 
-#include <most/most.h>
+#include <linux/most.h>
 #include "hal.h"
 #include "errors.h"
 #include "sysfs.h"
diff --git a/drivers/staging/most/i2c/i2c.c b/drivers/staging/most/i2c/i2c.c
index d07719c..d4a9cd8 100644
--- a/drivers/staging/most/i2c/i2c.c
+++ b/drivers/staging/most/i2c/i2c.c
@@ -14,7 +14,7 @@
 #include <linux/interrupt.h>
 #include <linux/err.h>
 
-#include <most/most.h>
+#include <linux/most.h>
 
 enum { CH_RX, CH_TX, NUM_CHANNELS };
 
diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c
index db42732..d6d5b2a 100644
--- a/drivers/staging/most/net/net.c
+++ b/drivers/staging/most/net/net.c
@@ -15,7 +15,7 @@
 #include <linux/list.h>
 #include <linux/wait.h>
 #include <linux/kobject.h>
-#include <most/most.h>
+#include <linux/most.h>
 
 #define MEP_HDR_LEN 8
 #define MDP_HDR_LEN 16
diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c
index 23baf4b..1527f41 100644
--- a/drivers/staging/most/sound/sound.c
+++ b/drivers/staging/most/sound/sound.c
@@ -17,7 +17,7 @@
 #include <sound/pcm_params.h>
 #include <linux/sched.h>
 #include <linux/kthread.h>
-#include <most/most.h>
+#include <linux/most.h>
 
 #define DRIVER_NAME "sound"
 #define STRING_SIZE	80
diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index 857f916..e8c5a8c 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -23,7 +23,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/etherdevice.h>
 #include <linux/uaccess.h>
-#include <most/most.h>
+#include <linux/most.h>
 
 #define USB_MTU			512
 #define NO_ISOCHRONOUS_URB	0
diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
index 9e9e45a..ce3a44a 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -21,7 +21,7 @@
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-fh.h>
 
-#include <most/most.h>
+#include <linux/most.h>
 
 #define V4L2_CMP_MAX_INPUT  1
 
diff --git a/drivers/staging/most/most.h b/include/linux/most.h
similarity index 100%
rename from drivers/staging/most/most.h
rename to include/linux/most.h
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v4 09/10] staging: most: Documentation: update ABI description
  2020-01-23 15:38 [PATCH v4 00/10] staging: most: move core module out of staging Christian Gromm
                   ` (7 preceding siblings ...)
  2020-01-23 15:38 ` [PATCH v4 08/10] staging: most: move core files out of the staging area Christian Gromm
@ 2020-01-23 15:38 ` Christian Gromm
  2020-01-23 15:38 ` [PATCH v4 10/10] staging: most: Documentation: move ABI description files out of staging area Christian Gromm
  9 siblings, 0 replies; 17+ messages in thread
From: Christian Gromm @ 2020-01-23 15:38 UTC (permalink / raw)
  To: gregkh; +Cc: Christian Gromm, driverdev-devel

This patch updates the ABI description files to be in sync
with current implementation.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
v2:
v3:
v4:

 .../most/Documentation/ABI/configfs-most.txt       |  8 --------
 .../most/Documentation/ABI/sysfs-bus-most.txt      | 24 +++-------------------
 2 files changed, 3 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/most/Documentation/ABI/configfs-most.txt b/drivers/staging/most/Documentation/ABI/configfs-most.txt
index 2bf8114..ed67a4d 100644
--- a/drivers/staging/most/Documentation/ABI/configfs-most.txt
+++ b/drivers/staging/most/Documentation/ABI/configfs-most.txt
@@ -194,11 +194,3 @@ Description:
 
 		destroy_link	write '1' to this attribute to destroy an
 				active link
-
-What: 		/sys/kernel/config/rdma_cm/<hca>/ports/<port-num>/default_roce_tos
-Date: 		March 8, 2019
-KernelVersion:  5.2
-Description: 	RDMA-CM QPs from HCA <hca> at port <port-num>
-		will be created with this TOS as default.
-		This can be overridden by using the rdma_set_option API.
-		The possible RoCE TOS values are 0-255.
diff --git a/drivers/staging/most/Documentation/ABI/sysfs-bus-most.txt b/drivers/staging/most/Documentation/ABI/sysfs-bus-most.txt
index d8fa841..6b1d06e 100644
--- a/drivers/staging/most/Documentation/ABI/sysfs-bus-most.txt
+++ b/drivers/staging/most/Documentation/ABI/sysfs-bus-most.txt
@@ -5,7 +5,7 @@ Contact:	Christian Gromm <christian.gromm@microchip.com>
 Description:
 		Provides information about the interface type and the physical
 		location of the device. Hardware attached via USB, for instance,
-		might return <usb_device 1-1.1:1.0>
+		might return <1-1.1:1.0>
 Users:
 
 What:		/sys/bus/most/devices/.../interface
@@ -278,25 +278,7 @@ Description:
 		Indicates whether current channel ran out of buffers.
 Users:
 
-What:		/sys/bus/most/drivers/mostcore/add_link
-Date:		March 2017
-KernelVersion:	4.15
-Contact:	Christian Gromm <christian.gromm@microchip.com>
-Description:
-		This is used to link a channel to a component of the
-		mostcore. A link created by writing to this file is
-		referred to as pipe.
-Users:
-
-What:		/sys/bus/most/drivers/mostcore/remove_link
-Date:		March 2017
-KernelVersion:	4.15
-Contact:	Christian Gromm <christian.gromm@microchip.com>
-Description:
-		This is used to unlink a channel from a component.
-Users:
-
-What:		/sys/bus/most/drivers/mostcore/components
+What:		/sys/bus/most/drivers/most_core/components
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
@@ -304,7 +286,7 @@ Description:
 		This is used to retrieve a list of registered components.
 Users:
 
-What:		/sys/bus/most/drivers/mostcore/links
+What:		/sys/bus/most/drivers/most_core/links
 Date:		March 2017
 KernelVersion:	4.15
 Contact:	Christian Gromm <christian.gromm@microchip.com>
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v4 10/10] staging: most: Documentation: move ABI description files out of staging area
  2020-01-23 15:38 [PATCH v4 00/10] staging: most: move core module out of staging Christian Gromm
                   ` (8 preceding siblings ...)
  2020-01-23 15:38 ` [PATCH v4 09/10] staging: most: Documentation: update ABI description Christian Gromm
@ 2020-01-23 15:38 ` Christian Gromm
  9 siblings, 0 replies; 17+ messages in thread
From: Christian Gromm @ 2020-01-23 15:38 UTC (permalink / raw)
  To: gregkh; +Cc: Christian Gromm, driverdev-devel

This patch moves the ABI description fils sysfs-bus-most and
configfs-most to the kernel's documentation folder.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
v2:
v3:
v4:

 .../ABI/configfs-most.txt => Documentation/ABI/testing/configfs-most      | 0
 .../ABI/sysfs-bus-most.txt => Documentation/ABI/testing/sysfs-bus-most    | 0
 2 files changed, 0 insertions(+), 0 deletions(-)
 rename drivers/staging/most/Documentation/ABI/configfs-most.txt => Documentation/ABI/testing/configfs-most (100%)
 rename drivers/staging/most/Documentation/ABI/sysfs-bus-most.txt => Documentation/ABI/testing/sysfs-bus-most (100%)

diff --git a/drivers/staging/most/Documentation/ABI/configfs-most.txt b/Documentation/ABI/testing/configfs-most
similarity index 100%
rename from drivers/staging/most/Documentation/ABI/configfs-most.txt
rename to Documentation/ABI/testing/configfs-most
diff --git a/drivers/staging/most/Documentation/ABI/sysfs-bus-most.txt b/Documentation/ABI/testing/sysfs-bus-most
similarity index 100%
rename from drivers/staging/most/Documentation/ABI/sysfs-bus-most.txt
rename to Documentation/ABI/testing/sysfs-bus-most
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v4 01/10] staging: most: remove device from interface structure
  2020-01-23 15:38 ` [PATCH v4 01/10] staging: most: remove device from interface structure Christian Gromm
@ 2020-01-23 18:18   ` Greg KH
  2020-01-24  8:56     ` Christian.Gromm
  0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2020-01-23 18:18 UTC (permalink / raw)
  To: Christian Gromm; +Cc: driverdev-devel

On Thu, Jan 23, 2020 at 04:38:17PM +0100, Christian Gromm wrote:
> This patch makes the adapter drivers use their own device structures
> when registering a most interface with the core module.
> With this the module that actually operates the physical device is the
> owner of the device.

Ick, why?  The interface should be part of sysfs, right, and now it
isn't?  Who handles the lifetime rules of these interfaces now?  Why
remove this?

Why isn't the interface dynamically created properly?  That should solve
the lifetime rules here, right?

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v4 01/10] staging: most: remove device from interface structure
  2020-01-23 18:18   ` Greg KH
@ 2020-01-24  8:56     ` Christian.Gromm
  2020-01-24  9:09       ` Greg KH
  0 siblings, 1 reply; 17+ messages in thread
From: Christian.Gromm @ 2020-01-24  8:56 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel

On Thu, 2020-01-23 at 19:18 +0100, Greg KH wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> On Thu, Jan 23, 2020 at 04:38:17PM +0100, Christian Gromm wrote:
> > This patch makes the adapter drivers use their own device
> > structures
> > when registering a most interface with the core module.
> > With this the module that actually operates the physical device is
> > the
> > owner of the device.
> 
> Ick, why?  The interface should be part of sysfs, right, and now it
> isn't?

It still is. What has changed is that the device that actually
represents the attached hardware is used (see probe function of
the USB adapter driver for instance).

> Who handles the lifetime rules of these interfaces now?  Why
> remove this?

The struct device that is allocated when attaching a MOST device is
handling the lifetime and the struct most_interface is
representing this device in the kernel. Hence, registered with sysfs.

This ensures that the device is present in the kernel until its
physical stature is being detached from the system.
The core driver is just the man in the middle that registers the
bus and itself as the driver and organizes the configfs, sysfs and
communication paths to user space.

> 
> Why isn't the interface dynamically created properly?  That should
> solve
> the lifetime rules here, right?

The interface is dynamically allocated. This happens inside the 
USB, DIM2, I2C etc. drivers. The struct most_interface is part of
the container struct there.

thanks,
Chris

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v4 01/10] staging: most: remove device from interface structure
  2020-01-24  8:56     ` Christian.Gromm
@ 2020-01-24  9:09       ` Greg KH
  2020-02-06  9:14         ` Christian.Gromm
  2020-03-23 14:16         ` Christian.Gromm
  0 siblings, 2 replies; 17+ messages in thread
From: Greg KH @ 2020-01-24  9:09 UTC (permalink / raw)
  To: Christian.Gromm; +Cc: driverdev-devel

On Fri, Jan 24, 2020 at 08:56:56AM +0000, Christian.Gromm@microchip.com wrote:
> On Thu, 2020-01-23 at 19:18 +0100, Greg KH wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you
> > know the content is safe
> > 
> > On Thu, Jan 23, 2020 at 04:38:17PM +0100, Christian Gromm wrote:
> > > This patch makes the adapter drivers use their own device
> > > structures
> > > when registering a most interface with the core module.
> > > With this the module that actually operates the physical device is
> > > the
> > > owner of the device.
> > 
> > Ick, why?  The interface should be part of sysfs, right, and now it
> > isn't?
> 
> It still is. What has changed is that the device that actually
> represents the attached hardware is used (see probe function of
> the USB adapter driver for instance).

Ah.  Ick.  odd...

> > Who handles the lifetime rules of these interfaces now?  Why
> > remove this?
> 
> The struct device that is allocated when attaching a MOST device is
> handling the lifetime and the struct most_interface is
> representing this device in the kernel. Hence, registered with sysfs.
> 
> This ensures that the device is present in the kernel until its
> physical stature is being detached from the system.
> The core driver is just the man in the middle that registers the
> bus and itself as the driver and organizes the configfs, sysfs and
> communication paths to user space.
> 
> > 
> > Why isn't the interface dynamically created properly?  That should
> > solve
> > the lifetime rules here, right?
> 
> The interface is dynamically allocated. This happens inside the 
> USB, DIM2, I2C etc. drivers. The struct most_interface is part of
> the container struct there.

Ok, I'll take the first 7 of these patches and see what the end result
looks like after that, it will make reviewing the code easier...

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v4 01/10] staging: most: remove device from interface structure
  2020-01-24  9:09       ` Greg KH
@ 2020-02-06  9:14         ` Christian.Gromm
  2020-02-14 16:17           ` Greg KH
  2020-03-23 14:16         ` Christian.Gromm
  1 sibling, 1 reply; 17+ messages in thread
From: Christian.Gromm @ 2020-02-06  9:14 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel

On Fri, 2020-01-24 at 10:09 +0100, Greg KH wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> On Fri, Jan 24, 2020 at 08:56:56AM +0000, 
> Christian.Gromm@microchip.com wrote:
> > On Thu, 2020-01-23 at 19:18 +0100, Greg KH wrote:
> > > EXTERNAL EMAIL: Do not click links or open attachments unless you
> > > know the content is safe
> > > 
> > > On Thu, Jan 23, 2020 at 04:38:17PM +0100, Christian Gromm wrote:
> > > > This patch makes the adapter drivers use their own device
> > > > structures
> > > > when registering a most interface with the core module.
> > > > With this the module that actually operates the physical device
> > > > is
> > > > the
> > > > owner of the device.
> > > 
> > > Ick, why?  The interface should be part of sysfs, right, and now
> > > it
> > > isn't?
> > 
> > It still is. What has changed is that the device that actually
> > represents the attached hardware is used (see probe function of
> > the USB adapter driver for instance).
> 
> Ah.  Ick.  odd...
> 
> > > Who handles the lifetime rules of these interfaces now?  Why
> > > remove this?
> > 
> > The struct device that is allocated when attaching a MOST device is
> > handling the lifetime and the struct most_interface is
> > representing this device in the kernel. Hence, registered with
> > sysfs.
> > 
> > This ensures that the device is present in the kernel until its
> > physical stature is being detached from the system.
> > The core driver is just the man in the middle that registers the
> > bus and itself as the driver and organizes the configfs, sysfs and
> > communication paths to user space.
> > 
> > > 
> > > Why isn't the interface dynamically created properly?  That
> > > should
> > > solve
> > > the lifetime rules here, right?
> > 
> > The interface is dynamically allocated. This happens inside the
> > USB, DIM2, I2C etc. drivers. The struct most_interface is part of
> > the container struct there.
> 
> Ok, I'll take the first 7 of these patches and see what the end
> result
> looks like after that, it will make reviewing the code easier...

Did you find some time for the review yet?

thanks,
Chris


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v4 01/10] staging: most: remove device from interface structure
  2020-02-06  9:14         ` Christian.Gromm
@ 2020-02-14 16:17           ` Greg KH
  0 siblings, 0 replies; 17+ messages in thread
From: Greg KH @ 2020-02-14 16:17 UTC (permalink / raw)
  To: Christian.Gromm; +Cc: driverdev-devel

On Thu, Feb 06, 2020 at 09:14:55AM +0000, Christian.Gromm@microchip.com wrote:
> On Fri, 2020-01-24 at 10:09 +0100, Greg KH wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you
> > know the content is safe
> > 
> > On Fri, Jan 24, 2020 at 08:56:56AM +0000, 
> > Christian.Gromm@microchip.com wrote:
> > > On Thu, 2020-01-23 at 19:18 +0100, Greg KH wrote:
> > > > EXTERNAL EMAIL: Do not click links or open attachments unless you
> > > > know the content is safe
> > > > 
> > > > On Thu, Jan 23, 2020 at 04:38:17PM +0100, Christian Gromm wrote:
> > > > > This patch makes the adapter drivers use their own device
> > > > > structures
> > > > > when registering a most interface with the core module.
> > > > > With this the module that actually operates the physical device
> > > > > is
> > > > > the
> > > > > owner of the device.
> > > > 
> > > > Ick, why?  The interface should be part of sysfs, right, and now
> > > > it
> > > > isn't?
> > > 
> > > It still is. What has changed is that the device that actually
> > > represents the attached hardware is used (see probe function of
> > > the USB adapter driver for instance).
> > 
> > Ah.  Ick.  odd...
> > 
> > > > Who handles the lifetime rules of these interfaces now?  Why
> > > > remove this?
> > > 
> > > The struct device that is allocated when attaching a MOST device is
> > > handling the lifetime and the struct most_interface is
> > > representing this device in the kernel. Hence, registered with
> > > sysfs.
> > > 
> > > This ensures that the device is present in the kernel until its
> > > physical stature is being detached from the system.
> > > The core driver is just the man in the middle that registers the
> > > bus and itself as the driver and organizes the configfs, sysfs and
> > > communication paths to user space.
> > > 
> > > > 
> > > > Why isn't the interface dynamically created properly?  That
> > > > should
> > > > solve
> > > > the lifetime rules here, right?
> > > 
> > > The interface is dynamically allocated. This happens inside the
> > > USB, DIM2, I2C etc. drivers. The struct most_interface is part of
> > > the container struct there.
> > 
> > Ok, I'll take the first 7 of these patches and see what the end
> > result
> > looks like after that, it will make reviewing the code easier...
> 
> Did you find some time for the review yet?

I haven't, sorry.  Can you resend the movement patch so that I can just
see it from that point?

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v4 01/10] staging: most: remove device from interface structure
  2020-01-24  9:09       ` Greg KH
  2020-02-06  9:14         ` Christian.Gromm
@ 2020-03-23 14:16         ` Christian.Gromm
  1 sibling, 0 replies; 17+ messages in thread
From: Christian.Gromm @ 2020-03-23 14:16 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel

On Fri, 2020-01-24 at 10:09 +0100, Greg KH wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> 
> Ok, I'll take the first 7 of these patches and see what the end
> result
> looks like after that, it will make reviewing the code easier...

Do you have a rough idea when I can expect this to be reviewed?

Should I resend one more time?


thanks,
Chris


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

end of thread, other threads:[~2020-03-23 14:16 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-23 15:38 [PATCH v4 00/10] staging: most: move core module out of staging Christian Gromm
2020-01-23 15:38 ` [PATCH v4 01/10] staging: most: remove device from interface structure Christian Gromm
2020-01-23 18:18   ` Greg KH
2020-01-24  8:56     ` Christian.Gromm
2020-01-24  9:09       ` Greg KH
2020-02-06  9:14         ` Christian.Gromm
2020-02-14 16:17           ` Greg KH
2020-03-23 14:16         ` Christian.Gromm
2020-01-23 15:38 ` [PATCH v4 02/10] staging: most: core: drop device reference Christian Gromm
2020-01-23 15:38 ` [PATCH v4 03/10] staging: most: remove struct device core driver Christian Gromm
2020-01-23 15:38 ` [PATCH v4 04/10] staging: most: core: remove container struct Christian Gromm
2020-01-23 15:38 ` [PATCH v4 05/10] staging: most: core: fix logging messages Christian Gromm
2020-01-23 15:38 ` [PATCH v4 06/10] staging: next: configfs: fix release link Christian Gromm
2020-01-23 15:38 ` [PATCH v4 07/10] staging: most: usb: check for NULL device Christian Gromm
2020-01-23 15:38 ` [PATCH v4 08/10] staging: most: move core files out of the staging area Christian Gromm
2020-01-23 15:38 ` [PATCH v4 09/10] staging: most: Documentation: update ABI description Christian Gromm
2020-01-23 15:38 ` [PATCH v4 10/10] staging: most: Documentation: move ABI description files out of staging area Christian Gromm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).