All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/50] staging: most: rework driver architecture and fix defects
@ 2017-11-21 14:04 Christian Gromm
  2017-11-21 14:04 ` [PATCH 01/50] staging: most: move core files Christian Gromm
                   ` (51 more replies)
  0 siblings, 52 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch set fixes bugs and integrates the driver to the kernel's device
model by revising its architecture. Part of this change is rearranging the
directory layout, renaming of files and folders and thereby creating a
clean driver structure.


Andrey Shvetsov (2):
  staging: most: update driver usage file
  staging: most: core: fix list traversing

Christian Gromm (48):
  staging: most: move core files
  staging: most: cdev: rename module
  staging: most: i2c: rename module
  staging: most: dim2: rename module
  staging: most: net: rename module
  staging: most: sound: rename module
  staging: most: usb: rename module
  staging: most: video: rename module
  staging: most: remove proprietary kobjects
  staging: most: core: remove function get_channel_by_iface
  staging: most: core: add a match function for the bus
  staging: most: core: encapsulate code in function
  staging: most: core: rename structure
  staging: most: core: rename struct most_c_aim_obj to pipe
  staging: most: core: rename struct memeber
  staging: most: core: rename members aim* of struct most_channel
  staging: most: core: use structure to pack driver specific data
  staging: most: core: track aim modules with linked list
  staging: most: core: fix sysfs attribute management
  staging: most: core: remove struct device
  staging: most: core: rename function
  staging: most: core: replace struct most_inst_obj
  staging: most: core: put channel name in struct most_channel
  staging: most: core: remove context pointer
  staging: most: usb: remove pointer initialization
  staging: most: rename struct most_aim
  staging: most: rename functions to register a driver with most_core
  staging: most: core: rename mod_list
  staging: most: core: rename aim variables
  staging: most: core: rename function link_channel_to_aim
  staging: most: net: remove aim designators
  staging: most: sound: remove aim designator
  staging: most: video: remove aim designators
  staging: most: cdev: rename struct aim_channel
  staging: most: cdev: rename variable aim_devno
  staging: most: cdev: rename class instance aim_class
  staging: most: cdev: rename variable cdev_aim
  staging: most: fix comment sections
  staging: most: core: denote modules as components
  staging: most: core: fix formatting
  staging: most: usb: clear functional stall on OUT endpoint
  staging: most: core: fix data type
  staging: most: core: check value returned by match function
  staging: most: cdev: replace function prefix
  staging: most: cdev: bundle module variables in structure
  staging: most: core: remove class generation
  staging: most: add ABI documentation
  staging: most: usb: fix show/store function names

 .../most/Documentation/ABI/sysfs-bus-most.txt      |  313 ++++
 .../staging/most/Documentation/driver_usage.txt    |  192 +-
 drivers/staging/most/Kconfig                       |   27 +-
 drivers/staging/most/Makefile                      |    5 +-
 drivers/staging/most/aim-cdev/Makefile             |    2 +-
 drivers/staging/most/aim-network/Makefile          |    2 +-
 drivers/staging/most/aim-sound/Makefile            |    2 +-
 drivers/staging/most/aim-v4l2/Makefile             |    2 +-
 drivers/staging/most/{aim-cdev => cdev}/Kconfig    |    6 +-
 drivers/staging/most/cdev/Makefile                 |    4 +
 drivers/staging/most/{aim-cdev => cdev}/cdev.c     |  186 +-
 drivers/staging/most/core.c                        | 1609 ++++++++++++++++
 .../staging/most/{mostcore/mostcore.h => core.h}   |   69 +-
 drivers/staging/most/{hdm-dim2 => dim2}/Kconfig    |    6 +-
 drivers/staging/most/dim2/Makefile                 |    4 +
 .../most/{hdm-dim2/dim2_hdm.c => dim2/dim2.c}      |   31 +-
 .../most/{hdm-dim2/dim2_hdm.h => dim2/dim2.h}      |    2 +-
 .../most/{hdm-dim2/dim2_errors.h => dim2/errors.h} |    2 +-
 .../most/{hdm-dim2/dim2_hal.c => dim2/hal.c}       |    8 +-
 .../most/{hdm-dim2/dim2_hal.h => dim2/hal.h}       |    4 +-
 .../most/{hdm-dim2/dim2_reg.h => dim2/reg.h}       |    2 +-
 drivers/staging/most/dim2/sysfs.c                  |   55 +
 .../most/{hdm-dim2/dim2_sysfs.h => dim2/sysfs.h}   |    8 +-
 drivers/staging/most/hdm-dim2/Makefile             |    2 +-
 drivers/staging/most/hdm-dim2/dim2_sysfs.c         |  115 --
 drivers/staging/most/hdm-i2c/Makefile              |    2 +-
 drivers/staging/most/hdm-usb/Makefile              |    2 +-
 drivers/staging/most/{hdm-i2c => i2c}/Kconfig      |    6 +-
 drivers/staging/most/i2c/Makefile                  |    4 +
 .../staging/most/{hdm-i2c/hdm_i2c.c => i2c/i2c.c}  |   11 +-
 drivers/staging/most/mostcore/Kconfig              |   14 -
 drivers/staging/most/mostcore/Makefile             |    3 -
 drivers/staging/most/mostcore/core.c               | 1949 --------------------
 drivers/staging/most/{aim-network => net}/Kconfig  |    6 +-
 drivers/staging/most/net/Makefile                  |    4 +
 .../most/{aim-network/networking.c => net/net.c}   |   51 +-
 drivers/staging/most/{aim-sound => sound}/Kconfig  |    6 +-
 drivers/staging/most/sound/Makefile                |    4 +
 drivers/staging/most/{aim-sound => sound}/sound.c  |   25 +-
 drivers/staging/most/{hdm-usb => usb}/Kconfig      |    7 +-
 drivers/staging/most/usb/Makefile                  |    4 +
 .../staging/most/{hdm-usb/hdm_usb.c => usb/usb.c}  |  264 +--
 drivers/staging/most/{aim-v4l2 => video}/Kconfig   |    6 +-
 drivers/staging/most/video/Makefile                |    4 +
 drivers/staging/most/{aim-v4l2 => video}/video.c   |  159 +-
 45 files changed, 2511 insertions(+), 2678 deletions(-)
 create mode 100644 drivers/staging/most/Documentation/ABI/sysfs-bus-most.txt
 rename drivers/staging/most/{aim-cdev => cdev}/Kconfig (70%)
 create mode 100644 drivers/staging/most/cdev/Makefile
 rename drivers/staging/most/{aim-cdev => cdev}/cdev.c (70%)
 create mode 100644 drivers/staging/most/core.c
 rename drivers/staging/most/{mostcore/mostcore.h => core.h} (86%)
 rename drivers/staging/most/{hdm-dim2 => dim2}/Kconfig (83%)
 create mode 100644 drivers/staging/most/dim2/Makefile
 rename drivers/staging/most/{hdm-dim2/dim2_hdm.c => dim2/dim2.c} (98%)
 rename drivers/staging/most/{hdm-dim2/dim2_hdm.h => dim2/dim2.h} (94%)
 rename drivers/staging/most/{hdm-dim2/dim2_errors.h => dim2/errors.h} (95%)
 rename drivers/staging/most/{hdm-dim2/dim2_hal.c => dim2/hal.c} (99%)
 rename drivers/staging/most/{hdm-dim2/dim2_hal.h => dim2/hal.h} (98%)
 rename drivers/staging/most/{hdm-dim2/dim2_reg.h => dim2/reg.h} (98%)
 create mode 100644 drivers/staging/most/dim2/sysfs.c
 rename drivers/staging/most/{hdm-dim2/dim2_sysfs.h => dim2/sysfs.h} (79%)
 delete mode 100644 drivers/staging/most/hdm-dim2/dim2_sysfs.c
 rename drivers/staging/most/{hdm-i2c => i2c}/Kconfig (72%)
 create mode 100644 drivers/staging/most/i2c/Makefile
 rename drivers/staging/most/{hdm-i2c/hdm_i2c.c => i2c/i2c.c} (98%)
 delete mode 100644 drivers/staging/most/mostcore/Kconfig
 delete mode 100644 drivers/staging/most/mostcore/Makefile
 delete mode 100644 drivers/staging/most/mostcore/core.c
 rename drivers/staging/most/{aim-network => net}/Kconfig (69%)
 create mode 100644 drivers/staging/most/net/Makefile
 rename drivers/staging/most/{aim-network/networking.c => net/net.c} (91%)
 rename drivers/staging/most/{aim-sound => sound}/Kconfig (72%)
 create mode 100644 drivers/staging/most/sound/Makefile
 rename drivers/staging/most/{aim-sound => sound}/sound.c (97%)
 rename drivers/staging/most/{hdm-usb => usb}/Kconfig (77%)
 create mode 100644 drivers/staging/most/usb/Makefile
 rename drivers/staging/most/{hdm-usb/hdm_usb.c => usb/usb.c} (86%)
 rename drivers/staging/most/{aim-v4l2 => video}/Kconfig (71%)
 create mode 100644 drivers/staging/most/video/Makefile
 rename drivers/staging/most/{aim-v4l2 => video}/video.c (76%)

-- 
2.7.4

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

* [PATCH 01/50] staging: most: move core files
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 02/50] staging: most: cdev: rename module Christian Gromm
                   ` (50 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch moves the core files to the root dir of the driver.
This is needed to clean up the directory layout.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/Kconfig                         | 13 ++++++++-----
 drivers/staging/most/Makefile                        |  5 ++++-
 drivers/staging/most/aim-cdev/Makefile               |  2 +-
 drivers/staging/most/aim-cdev/cdev.c                 |  2 +-
 drivers/staging/most/aim-network/Makefile            |  2 +-
 drivers/staging/most/aim-network/networking.c        |  2 +-
 drivers/staging/most/aim-sound/Makefile              |  2 +-
 drivers/staging/most/aim-sound/sound.c               |  2 +-
 drivers/staging/most/aim-v4l2/Makefile               |  2 +-
 drivers/staging/most/aim-v4l2/video.c                |  2 +-
 drivers/staging/most/{mostcore => }/core.c           |  2 +-
 drivers/staging/most/{mostcore/mostcore.h => core.h} |  2 +-
 drivers/staging/most/hdm-dim2/Makefile               |  2 +-
 drivers/staging/most/hdm-dim2/dim2_hdm.c             |  2 +-
 drivers/staging/most/hdm-i2c/Makefile                |  2 +-
 drivers/staging/most/hdm-i2c/hdm_i2c.c               |  2 +-
 drivers/staging/most/hdm-usb/Makefile                |  2 +-
 drivers/staging/most/hdm-usb/hdm_usb.c               |  2 +-
 drivers/staging/most/mostcore/Kconfig                | 14 --------------
 drivers/staging/most/mostcore/Makefile               |  3 ---
 20 files changed, 28 insertions(+), 39 deletions(-)
 rename drivers/staging/most/{mostcore => }/core.c (99%)
 rename drivers/staging/most/{mostcore/mostcore.h => core.h} (99%)
 delete mode 100644 drivers/staging/most/mostcore/Kconfig
 delete mode 100644 drivers/staging/most/mostcore/Makefile

diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig
index 0b9b9b5..2045f7a 100644
--- a/drivers/staging/most/Kconfig
+++ b/drivers/staging/most/Kconfig
@@ -1,10 +1,15 @@
 menuconfig MOST
-        tristate "MOST driver"
+        tristate "MOST support"
 	depends on HAS_DMA
-        select MOSTCORE
         default n
         ---help---
-          This option allows you to enable support for MOST Network transceivers.
+	  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.
 
@@ -12,8 +17,6 @@ menuconfig MOST
 
 if MOST
 
-source "drivers/staging/most/mostcore/Kconfig"
-
 source "drivers/staging/most/aim-cdev/Kconfig"
 
 source "drivers/staging/most/aim-network/Kconfig"
diff --git a/drivers/staging/most/Makefile b/drivers/staging/most/Makefile
index f5bbb9d..7f6aa9c 100644
--- a/drivers/staging/most/Makefile
+++ b/drivers/staging/most/Makefile
@@ -1,5 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_MOSTCORE)	+= mostcore/
+obj-$(CONFIG_MOST) += most_core.o
+most_core-y := core.o
+ccflags-y += -Idrivers/staging/
+
 obj-$(CONFIG_AIM_CDEV)	+= aim-cdev/
 obj-$(CONFIG_AIM_NETWORK)	+= aim-network/
 obj-$(CONFIG_AIM_SOUND)	+= aim-sound/
diff --git a/drivers/staging/most/aim-cdev/Makefile b/drivers/staging/most/aim-cdev/Makefile
index 0bcc6c6..b7afcb4 100644
--- a/drivers/staging/most/aim-cdev/Makefile
+++ b/drivers/staging/most/aim-cdev/Makefile
@@ -1,4 +1,4 @@
 obj-$(CONFIG_AIM_CDEV) += aim_cdev.o
 
 aim_cdev-objs := cdev.o
-ccflags-y += -Idrivers/staging/most/mostcore/
\ No newline at end of file
+ccflags-y += -Idrivers/staging/
diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
index 1e5cbc8..b6849c8 100644
--- a/drivers/staging/most/aim-cdev/cdev.c
+++ b/drivers/staging/most/aim-cdev/cdev.c
@@ -22,7 +22,7 @@
 #include <linux/kfifo.h>
 #include <linux/uaccess.h>
 #include <linux/idr.h>
-#include "mostcore.h"
+#include "most/core.h"
 
 static dev_t aim_devno;
 static struct class *aim_class;
diff --git a/drivers/staging/most/aim-network/Makefile b/drivers/staging/most/aim-network/Makefile
index 840c1dd..a874aac8d 100644
--- a/drivers/staging/most/aim-network/Makefile
+++ b/drivers/staging/most/aim-network/Makefile
@@ -1,4 +1,4 @@
 obj-$(CONFIG_AIM_NETWORK) += aim_network.o
 
 aim_network-objs := networking.o
-ccflags-y += -Idrivers/staging/most/mostcore/
+ccflags-y += -Idrivers/staging/
diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c
index 936f013..4936249 100644
--- a/drivers/staging/most/aim-network/networking.c
+++ b/drivers/staging/most/aim-network/networking.c
@@ -21,7 +21,7 @@
 #include <linux/list.h>
 #include <linux/wait.h>
 #include <linux/kobject.h>
-#include "mostcore.h"
+#include "most/core.h"
 
 #define MEP_HDR_LEN 8
 #define MDP_HDR_LEN 16
diff --git a/drivers/staging/most/aim-sound/Makefile b/drivers/staging/most/aim-sound/Makefile
index beba958..d41b85b 100644
--- a/drivers/staging/most/aim-sound/Makefile
+++ b/drivers/staging/most/aim-sound/Makefile
@@ -1,4 +1,4 @@
 obj-$(CONFIG_AIM_SOUND) += aim_sound.o
 
 aim_sound-objs := sound.o
-ccflags-y += -Idrivers/staging/most/mostcore/
+ccflags-y += -Idrivers/staging/
diff --git a/drivers/staging/most/aim-sound/sound.c b/drivers/staging/most/aim-sound/sound.c
index ea1366a..72603ae 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -22,7 +22,7 @@
 #include <sound/pcm_params.h>
 #include <linux/sched.h>
 #include <linux/kthread.h>
-#include <mostcore.h>
+#include <most/core.h>
 
 #define DRIVER_NAME "sound"
 
diff --git a/drivers/staging/most/aim-v4l2/Makefile b/drivers/staging/most/aim-v4l2/Makefile
index 69a7524..a8e8b49 100644
--- a/drivers/staging/most/aim-v4l2/Makefile
+++ b/drivers/staging/most/aim-v4l2/Makefile
@@ -2,4 +2,4 @@ obj-$(CONFIG_AIM_V4L2) += aim_v4l2.o
 
 aim_v4l2-objs := video.o
 
-ccflags-y += -Idrivers/staging/most/mostcore/
+ccflags-y += -Idrivers/staging/
diff --git a/drivers/staging/most/aim-v4l2/video.c b/drivers/staging/most/aim-v4l2/video.c
index e074841..b418c09 100644
--- a/drivers/staging/most/aim-v4l2/video.c
+++ b/drivers/staging/most/aim-v4l2/video.c
@@ -27,7 +27,7 @@
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-fh.h>
 
-#include "mostcore.h"
+#include "most/core.h"
 
 #define V4L2_AIM_MAX_INPUT  1
 
diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/core.c
similarity index 99%
rename from drivers/staging/most/mostcore/core.c
rename to drivers/staging/most/core.c
index 069269d..6ee6acf 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/core.c
@@ -27,7 +27,7 @@
 #include <linux/kthread.h>
 #include <linux/dma-mapping.h>
 #include <linux/idr.h>
-#include "mostcore.h"
+#include <most/core.h>
 
 #define MAX_CHANNELS	64
 #define STRING_SIZE	80
diff --git a/drivers/staging/most/mostcore/mostcore.h b/drivers/staging/most/core.h
similarity index 99%
rename from drivers/staging/most/mostcore/mostcore.h
rename to drivers/staging/most/core.h
index 915e515..a6e618c 100644
--- a/drivers/staging/most/mostcore/mostcore.h
+++ b/drivers/staging/most/core.h
@@ -1,5 +1,5 @@
 /*
- * mostcore.h - Interface between MostCore,
+ * most.h - Interface between MostCore,
  *   Hardware Dependent Module (HDM) and Application Interface Module (AIM).
  *
  * Copyright (C) 2013-2015, Microchip Technology Germany II GmbH & Co. KG
diff --git a/drivers/staging/most/hdm-dim2/Makefile b/drivers/staging/most/hdm-dim2/Makefile
index 6bbee87..b66492b 100644
--- a/drivers/staging/most/hdm-dim2/Makefile
+++ b/drivers/staging/most/hdm-dim2/Makefile
@@ -1,5 +1,5 @@
 obj-$(CONFIG_HDM_DIM2) += hdm_dim2.o
 
 hdm_dim2-objs := dim2_hdm.o dim2_hal.o dim2_sysfs.o
-ccflags-y += -Idrivers/staging/most/mostcore/
+ccflags-y += -Idrivers/staging/
 ccflags-y += -Idrivers/staging/most/aim-network/
diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c
index df7021c..4793e63 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hdm.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c
@@ -25,7 +25,7 @@
 #include <linux/sched.h>
 #include <linux/kthread.h>
 
-#include <mostcore.h>
+#include "most/core.h"
 #include "dim2_hal.h"
 #include "dim2_hdm.h"
 #include "dim2_errors.h"
diff --git a/drivers/staging/most/hdm-i2c/Makefile b/drivers/staging/most/hdm-i2c/Makefile
index 03a4a59..6ddc78a 100644
--- a/drivers/staging/most/hdm-i2c/Makefile
+++ b/drivers/staging/most/hdm-i2c/Makefile
@@ -1,3 +1,3 @@
 obj-$(CONFIG_HDM_I2C) += hdm_i2c.o
 
-ccflags-y += -Idrivers/staging/most/mostcore/
+ccflags-y += -Idrivers/staging/
diff --git a/drivers/staging/most/hdm-i2c/hdm_i2c.c b/drivers/staging/most/hdm-i2c/hdm_i2c.c
index 2b4de40..746d56f 100644
--- a/drivers/staging/most/hdm-i2c/hdm_i2c.c
+++ b/drivers/staging/most/hdm-i2c/hdm_i2c.c
@@ -21,7 +21,7 @@
 #include <linux/interrupt.h>
 #include <linux/err.h>
 
-#include <mostcore.h>
+#include "most/core.h"
 
 enum { CH_RX, CH_TX, NUM_CHANNELS };
 
diff --git a/drivers/staging/most/hdm-usb/Makefile b/drivers/staging/most/hdm-usb/Makefile
index 6bbacb4..4fea7c2 100644
--- a/drivers/staging/most/hdm-usb/Makefile
+++ b/drivers/staging/most/hdm-usb/Makefile
@@ -1,4 +1,4 @@
 obj-$(CONFIG_HDM_USB) += hdm_usb.o
 
-ccflags-y += -Idrivers/staging/most/mostcore/
+ccflags-y += -Idrivers/staging/
 ccflags-y += -Idrivers/staging/most/aim-network/
diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c
index 85775da..5734e541 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -29,7 +29,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/etherdevice.h>
 #include <linux/uaccess.h>
-#include "mostcore.h"
+#include "most/core.h"
 
 #define USB_MTU			512
 #define NO_ISOCHRONOUS_URB	0
diff --git a/drivers/staging/most/mostcore/Kconfig b/drivers/staging/most/mostcore/Kconfig
deleted file mode 100644
index 4717254..0000000
--- a/drivers/staging/most/mostcore/Kconfig
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# MOSTCore configuration
-#
-
-config MOSTCORE
-	tristate "MOST Core"
-	depends on HAS_DMA
-
-	---help---
-	  Say Y here if you want to enable MOST support.
-	  This device driver needs at least an additional AIM and HDM to work.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called mostcore.
diff --git a/drivers/staging/most/mostcore/Makefile b/drivers/staging/most/mostcore/Makefile
deleted file mode 100644
index a078f01..0000000
--- a/drivers/staging/most/mostcore/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-obj-$(CONFIG_MOSTCORE) += mostcore.o
-
-mostcore-objs := core.o
-- 
2.7.4

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

* [PATCH 02/50] staging: most: cdev: rename module
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
  2017-11-21 14:04 ` [PATCH 01/50] staging: most: move core files Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 03/50] staging: most: i2c: " Christian Gromm
                   ` (49 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the folder of the cdev module. This is needed
to clear the directory layout.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/Kconfig                    | 2 +-
 drivers/staging/most/{aim-cdev => cdev}/Kconfig | 6 +++---
 drivers/staging/most/cdev/Makefile              | 4 ++++
 drivers/staging/most/{aim-cdev => cdev}/cdev.c  | 0
 4 files changed, 8 insertions(+), 4 deletions(-)
 rename drivers/staging/most/{aim-cdev => cdev}/Kconfig (70%)
 create mode 100644 drivers/staging/most/cdev/Makefile
 rename drivers/staging/most/{aim-cdev => cdev}/cdev.c (100%)

diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig
index 2045f7a..60a2825 100644
--- a/drivers/staging/most/Kconfig
+++ b/drivers/staging/most/Kconfig
@@ -17,7 +17,7 @@ menuconfig MOST
 
 if MOST
 
-source "drivers/staging/most/aim-cdev/Kconfig"
+source "drivers/staging/most/cdev/Kconfig"
 
 source "drivers/staging/most/aim-network/Kconfig"
 
diff --git a/drivers/staging/most/aim-cdev/Kconfig b/drivers/staging/most/cdev/Kconfig
similarity index 70%
rename from drivers/staging/most/aim-cdev/Kconfig
rename to drivers/staging/most/cdev/Kconfig
index 3c59f1b..2b04e26 100644
--- a/drivers/staging/most/aim-cdev/Kconfig
+++ b/drivers/staging/most/cdev/Kconfig
@@ -2,11 +2,11 @@
 # MOST Cdev configuration
 #
 
-config AIM_CDEV
-	tristate "Cdev AIM"
+config MOST_CDEV
+	tristate "Cdev"
 
 	---help---
 	  Say Y here if you want to commumicate via character devices.
 
 	  To compile this driver as a module, choose M here: the
-	  module will be called aim_cdev.
\ No newline at end of file
+	  module will be called most_cdev.
diff --git a/drivers/staging/most/cdev/Makefile b/drivers/staging/most/cdev/Makefile
new file mode 100644
index 0000000..afb9870
--- /dev/null
+++ b/drivers/staging/most/cdev/Makefile
@@ -0,0 +1,4 @@
+obj-$(CONFIG_MOST_CDEV) += most_cdev.o
+
+most_cdev-objs := cdev.o
+ccflags-y += -Idrivers/staging/
diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/cdev/cdev.c
similarity index 100%
rename from drivers/staging/most/aim-cdev/cdev.c
rename to drivers/staging/most/cdev/cdev.c
-- 
2.7.4

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

* [PATCH 03/50] staging: most: i2c: rename module
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
  2017-11-21 14:04 ` [PATCH 01/50] staging: most: move core files Christian Gromm
  2017-11-21 14:04 ` [PATCH 02/50] staging: most: cdev: rename module Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 04/50] staging: most: dim2: " Christian Gromm
                   ` (48 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the folder of the i2c module. It is needed
to clear the directory layout.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/Kconfig                          | 2 +-
 drivers/staging/most/{hdm-i2c => i2c}/Kconfig         | 6 +++---
 drivers/staging/most/i2c/Makefile                     | 4 ++++
 drivers/staging/most/{hdm-i2c/hdm_i2c.c => i2c/i2c.c} | 2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)
 rename drivers/staging/most/{hdm-i2c => i2c}/Kconfig (72%)
 create mode 100644 drivers/staging/most/i2c/Makefile
 rename drivers/staging/most/{hdm-i2c/hdm_i2c.c => i2c/i2c.c} (99%)

diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig
index 60a2825..b3393a5 100644
--- a/drivers/staging/most/Kconfig
+++ b/drivers/staging/most/Kconfig
@@ -27,7 +27,7 @@ source "drivers/staging/most/aim-v4l2/Kconfig"
 
 source "drivers/staging/most/hdm-dim2/Kconfig"
 
-source "drivers/staging/most/hdm-i2c/Kconfig"
+source "drivers/staging/most/i2c/Kconfig"
 
 source "drivers/staging/most/hdm-usb/Kconfig"
 
diff --git a/drivers/staging/most/hdm-i2c/Kconfig b/drivers/staging/most/i2c/Kconfig
similarity index 72%
rename from drivers/staging/most/hdm-i2c/Kconfig
rename to drivers/staging/most/i2c/Kconfig
index 6fd7983..79d0ff2 100644
--- a/drivers/staging/most/hdm-i2c/Kconfig
+++ b/drivers/staging/most/i2c/Kconfig
@@ -2,11 +2,11 @@
 # MOST I2C configuration
 #
 
-config HDM_I2C
-	tristate "I2C HDM"
+config MOST_I2C
+	tristate "I2C"
 	depends on I2C
 	---help---
 	  Say Y here if you want to connect via I2C to network tranceiver.
 
 	  To compile this driver as a module, choose M here: the
-	  module will be called hdm_i2c.
+	  module will be called most_i2c.
diff --git a/drivers/staging/most/i2c/Makefile b/drivers/staging/most/i2c/Makefile
new file mode 100644
index 0000000..a7d094c
--- /dev/null
+++ b/drivers/staging/most/i2c/Makefile
@@ -0,0 +1,4 @@
+obj-$(CONFIG_MOST_I2C) += most_i2c.o
+
+most_i2c-objs := i2c.o
+ccflags-y += -Idrivers/staging/
diff --git a/drivers/staging/most/hdm-i2c/hdm_i2c.c b/drivers/staging/most/i2c/i2c.c
similarity index 99%
rename from drivers/staging/most/hdm-i2c/hdm_i2c.c
rename to drivers/staging/most/i2c/i2c.c
index 746d56f..6081943 100644
--- a/drivers/staging/most/hdm-i2c/hdm_i2c.c
+++ b/drivers/staging/most/i2c/i2c.c
@@ -1,5 +1,5 @@
 /*
- * hdm_i2c.c - Hardware Dependent Module for I2C Interface
+ * i2c.c - Hardware Dependent Module for I2C Interface
  *
  * Copyright (C) 2013-2015, Microchip Technology Germany II GmbH & Co. KG
  *
-- 
2.7.4

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

* [PATCH 04/50] staging: most: dim2: rename module
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (2 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 03/50] staging: most: i2c: " Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 05/50] staging: most: net: " Christian Gromm
                   ` (47 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the folder and source files of the dim2 module. It is
needed to clear the directory layout of the driver.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/Kconfig                                   |  2 +-
 drivers/staging/most/{hdm-dim2 => dim2}/Kconfig                |  6 +++---
 drivers/staging/most/dim2/Makefile                             |  4 ++++
 drivers/staging/most/{hdm-dim2/dim2_hdm.c => dim2/dim2.c}      | 10 +++++-----
 drivers/staging/most/{hdm-dim2/dim2_hdm.h => dim2/dim2.h}      |  2 +-
 drivers/staging/most/{hdm-dim2/dim2_errors.h => dim2/errors.h} |  2 +-
 drivers/staging/most/{hdm-dim2/dim2_hal.c => dim2/hal.c}       |  8 ++++----
 drivers/staging/most/{hdm-dim2/dim2_hal.h => dim2/hal.h}       |  4 ++--
 drivers/staging/most/{hdm-dim2/dim2_reg.h => dim2/reg.h}       |  2 +-
 drivers/staging/most/{hdm-dim2/dim2_sysfs.c => dim2/sysfs.c}   |  4 ++--
 drivers/staging/most/{hdm-dim2/dim2_sysfs.h => dim2/sysfs.h}   |  2 +-
 11 files changed, 25 insertions(+), 21 deletions(-)
 rename drivers/staging/most/{hdm-dim2 => dim2}/Kconfig (83%)
 create mode 100644 drivers/staging/most/dim2/Makefile
 rename drivers/staging/most/{hdm-dim2/dim2_hdm.c => dim2/dim2.c} (99%)
 rename drivers/staging/most/{hdm-dim2/dim2_hdm.h => dim2/dim2.h} (94%)
 rename drivers/staging/most/{hdm-dim2/dim2_errors.h => dim2/errors.h} (95%)
 rename drivers/staging/most/{hdm-dim2/dim2_hal.c => dim2/hal.c} (99%)
 rename drivers/staging/most/{hdm-dim2/dim2_hal.h => dim2/hal.h} (98%)
 rename drivers/staging/most/{hdm-dim2/dim2_reg.h => dim2/reg.h} (98%)
 rename drivers/staging/most/{hdm-dim2/dim2_sysfs.c => dim2/sysfs.c} (97%)
 rename drivers/staging/most/{hdm-dim2/dim2_sysfs.h => dim2/sysfs.h} (95%)

diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig
index b3393a5..88a415b 100644
--- a/drivers/staging/most/Kconfig
+++ b/drivers/staging/most/Kconfig
@@ -25,7 +25,7 @@ source "drivers/staging/most/aim-sound/Kconfig"
 
 source "drivers/staging/most/aim-v4l2/Kconfig"
 
-source "drivers/staging/most/hdm-dim2/Kconfig"
+source "drivers/staging/most/dim2/Kconfig"
 
 source "drivers/staging/most/i2c/Kconfig"
 
diff --git a/drivers/staging/most/hdm-dim2/Kconfig b/drivers/staging/most/dim2/Kconfig
similarity index 83%
rename from drivers/staging/most/hdm-dim2/Kconfig
rename to drivers/staging/most/dim2/Kconfig
index 663bfeb..e39c4e5 100644
--- a/drivers/staging/most/hdm-dim2/Kconfig
+++ b/drivers/staging/most/dim2/Kconfig
@@ -2,8 +2,8 @@
 # MediaLB configuration
 #
 
-config HDM_DIM2
-	tristate "DIM2 HDM"
+config MOST_DIM2
+	tristate "DIM2"
 	depends on HAS_IOMEM
 
 	---help---
@@ -13,4 +13,4 @@ config HDM_DIM2
 	  maintainer of this driver.
 
 	  To compile this driver as a module, choose M here: the
-	  module will be called hdm_dim2.
+	  module will be called most_dim2.
diff --git a/drivers/staging/most/dim2/Makefile b/drivers/staging/most/dim2/Makefile
new file mode 100644
index 0000000..66676f5
--- /dev/null
+++ b/drivers/staging/most/dim2/Makefile
@@ -0,0 +1,4 @@
+obj-$(CONFIG_MOST_DIM2) += most_dim2.o
+
+most_dim2-objs := dim2.o hal.o sysfs.o
+ccflags-y += -Idrivers/staging/
diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/dim2/dim2.c
similarity index 99%
rename from drivers/staging/most/hdm-dim2/dim2_hdm.c
rename to drivers/staging/most/dim2/dim2.c
index 4793e63..0a1b785 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hdm.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -1,5 +1,5 @@
 /*
- * dim2_hdm.c - MediaLB DIM2 Hardware Dependent Module
+ * dim2.c - MediaLB DIM2 Hardware Dependent Module
  *
  * Copyright (C) 2015-2016, Microchip Technology Germany II GmbH & Co. KG
  *
@@ -26,10 +26,10 @@
 #include <linux/kthread.h>
 
 #include "most/core.h"
-#include "dim2_hal.h"
-#include "dim2_hdm.h"
-#include "dim2_errors.h"
-#include "dim2_sysfs.h"
+#include "hal.h"
+#include "dim2.h"
+#include "errors.h"
+#include "sysfs.h"
 
 #define DMA_CHANNELS (32 - 1)  /* channel 0 is a system channel */
 
diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.h b/drivers/staging/most/dim2/dim2.h
similarity index 94%
rename from drivers/staging/most/hdm-dim2/dim2_hdm.h
rename to drivers/staging/most/dim2/dim2.h
index 4050e7c..7fff99c 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hdm.h
+++ b/drivers/staging/most/dim2/dim2.h
@@ -1,5 +1,5 @@
 /*
- * dim2_hdm.h - MediaLB DIM2 HDM Header
+ * dim2.h - MediaLB DIM2 HDM Header
  *
  * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG
  *
diff --git a/drivers/staging/most/hdm-dim2/dim2_errors.h b/drivers/staging/most/dim2/errors.h
similarity index 95%
rename from drivers/staging/most/hdm-dim2/dim2_errors.h
rename to drivers/staging/most/dim2/errors.h
index 66343ba..0cd8400 100644
--- a/drivers/staging/most/hdm-dim2/dim2_errors.h
+++ b/drivers/staging/most/dim2/errors.h
@@ -1,5 +1,5 @@
 /*
- * dim2_errors.h - Definitions of errors for DIM2 HAL API
+ * errors.h - Definitions of errors for DIM2 HAL API
  * (MediaLB, Device Interface Macro IP, OS62420)
  *
  * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG
diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/dim2/hal.c
similarity index 99%
rename from drivers/staging/most/hdm-dim2/dim2_hal.c
rename to drivers/staging/most/dim2/hal.c
index 9148464..9f00ecc 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hal.c
+++ b/drivers/staging/most/dim2/hal.c
@@ -1,5 +1,5 @@
 /*
- * dim2_hal.c - DIM2 HAL implementation
+ * hal.c - DIM2 HAL implementation
  * (MediaLB, Device Interface Macro IP, OS62420)
  *
  * Copyright (C) 2015-2016, Microchip Technology Germany II GmbH & Co. KG
@@ -14,9 +14,9 @@
 
 /* Author: Andrey Shvetsov <andrey.shvetsov@k2l.de> */
 
-#include "dim2_hal.h"
-#include "dim2_errors.h"
-#include "dim2_reg.h"
+#include "hal.h"
+#include "errors.h"
+#include "reg.h"
 #include <linux/stddef.h>
 #include <linux/kernel.h>
 
diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/dim2/hal.h
similarity index 98%
rename from drivers/staging/most/hdm-dim2/dim2_hal.h
rename to drivers/staging/most/dim2/hal.h
index 6df6ea5..a08e4a4 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hal.h
+++ b/drivers/staging/most/dim2/hal.h
@@ -1,5 +1,5 @@
 /*
- * dim2_hal.h - DIM2 HAL interface
+ * hal.h - DIM2 HAL interface
  * (MediaLB, Device Interface Macro IP, OS62420)
  *
  * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG
@@ -16,7 +16,7 @@
 #define _DIM2_HAL_H
 
 #include <linux/types.h>
-#include "dim2_reg.h"
+#include "reg.h"
 
 /*
  * The values below are specified in the hardware specification.
diff --git a/drivers/staging/most/hdm-dim2/dim2_reg.h b/drivers/staging/most/dim2/reg.h
similarity index 98%
rename from drivers/staging/most/hdm-dim2/dim2_reg.h
rename to drivers/staging/most/dim2/reg.h
index f7d9fbc..b0d095c 100644
--- a/drivers/staging/most/hdm-dim2/dim2_reg.h
+++ b/drivers/staging/most/dim2/reg.h
@@ -1,5 +1,5 @@
 /*
- * dim2_reg.h - Definitions for registers of DIM2
+ * reg.h - Definitions for registers of DIM2
  * (MediaLB, Device Interface Macro IP, OS62420)
  *
  * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG
diff --git a/drivers/staging/most/hdm-dim2/dim2_sysfs.c b/drivers/staging/most/dim2/sysfs.c
similarity index 97%
rename from drivers/staging/most/hdm-dim2/dim2_sysfs.c
rename to drivers/staging/most/dim2/sysfs.c
index d8b22f9..1331cf0 100644
--- a/drivers/staging/most/hdm-dim2/dim2_sysfs.c
+++ b/drivers/staging/most/dim2/sysfs.c
@@ -1,5 +1,5 @@
 /*
- * dim2_sysfs.c - MediaLB sysfs information
+ * sysfs.c - MediaLB sysfs information
  *
  * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG
  *
@@ -16,7 +16,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
-#include "dim2_sysfs.h"
+#include "sysfs.h"
 
 struct bus_attr {
 	struct attribute attr;
diff --git a/drivers/staging/most/hdm-dim2/dim2_sysfs.h b/drivers/staging/most/dim2/sysfs.h
similarity index 95%
rename from drivers/staging/most/hdm-dim2/dim2_sysfs.h
rename to drivers/staging/most/dim2/sysfs.h
index b71dd02..236de47 100644
--- a/drivers/staging/most/hdm-dim2/dim2_sysfs.h
+++ b/drivers/staging/most/dim2/sysfs.h
@@ -1,5 +1,5 @@
 /*
- * dim2_sysfs.h - MediaLB sysfs information
+ * sysfs.h - MediaLB sysfs information
  *
  * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG
  *
-- 
2.7.4

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

* [PATCH 05/50] staging: most: net: rename module
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (3 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 04/50] staging: most: dim2: " Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 06/50] staging: most: sound: " Christian Gromm
                   ` (46 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the folder and the source file of the networking module.
It is needed to clean up the directory layout of the driver.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/Kconfig                                 | 2 +-
 drivers/staging/most/{aim-network => net}/Kconfig            | 6 +++---
 drivers/staging/most/net/Makefile                            | 4 ++++
 drivers/staging/most/{aim-network/networking.c => net/net.c} | 2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)
 rename drivers/staging/most/{aim-network => net}/Kconfig (69%)
 create mode 100644 drivers/staging/most/net/Makefile
 rename drivers/staging/most/{aim-network/networking.c => net/net.c} (99%)

diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig
index 88a415b..68a9c89 100644
--- a/drivers/staging/most/Kconfig
+++ b/drivers/staging/most/Kconfig
@@ -19,7 +19,7 @@ if MOST
 
 source "drivers/staging/most/cdev/Kconfig"
 
-source "drivers/staging/most/aim-network/Kconfig"
+source "drivers/staging/most/net/Kconfig"
 
 source "drivers/staging/most/aim-sound/Kconfig"
 
diff --git a/drivers/staging/most/aim-network/Kconfig b/drivers/staging/most/net/Kconfig
similarity index 69%
rename from drivers/staging/most/aim-network/Kconfig
rename to drivers/staging/most/net/Kconfig
index 4c66b24..795330b 100644
--- a/drivers/staging/most/aim-network/Kconfig
+++ b/drivers/staging/most/net/Kconfig
@@ -2,12 +2,12 @@
 # MOST Networking configuration
 #
 
-config AIM_NETWORK
-	tristate "Networking AIM"
+config MOST_NET
+	tristate "Net"
 	depends on NET
 
 	---help---
 	  Say Y here if you want to commumicate via a networking device.
 
 	  To compile this driver as a module, choose M here: the
-	  module will be called aim_network.
+	  module will be called most_net.
diff --git a/drivers/staging/most/net/Makefile b/drivers/staging/most/net/Makefile
new file mode 100644
index 0000000..54500aa
--- /dev/null
+++ b/drivers/staging/most/net/Makefile
@@ -0,0 +1,4 @@
+obj-$(CONFIG_MOST_NET) += most_net.o
+
+most_net-objs := net.o
+ccflags-y += -Idrivers/staging/
diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/net/net.c
similarity index 99%
rename from drivers/staging/most/aim-network/networking.c
rename to drivers/staging/most/net/net.c
index 4936249..9b4a804 100644
--- a/drivers/staging/most/aim-network/networking.c
+++ b/drivers/staging/most/net/net.c
@@ -502,7 +502,7 @@ static int aim_rx_data(struct mbo *mbo)
 }
 
 static struct most_aim aim = {
-	.name = "networking",
+	.name = "net",
 	.probe_channel = aim_probe_channel,
 	.disconnect_channel = aim_disconnect_channel,
 	.tx_completion = aim_resume_tx_channel,
-- 
2.7.4

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

* [PATCH 06/50] staging: most: sound: rename module
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (4 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 05/50] staging: most: net: " Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 07/50] staging: most: usb: " Christian Gromm
                   ` (45 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the folder of the sound module. It is needed
to clean up the directory layout of the driver.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/Kconfig                      | 2 +-
 drivers/staging/most/{aim-sound => sound}/Kconfig | 6 +++---
 drivers/staging/most/sound/Makefile               | 4 ++++
 drivers/staging/most/{aim-sound => sound}/sound.c | 0
 4 files changed, 8 insertions(+), 4 deletions(-)
 rename drivers/staging/most/{aim-sound => sound}/Kconfig (72%)
 create mode 100644 drivers/staging/most/sound/Makefile
 rename drivers/staging/most/{aim-sound => sound}/sound.c (100%)

diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig
index 68a9c89..3f12711 100644
--- a/drivers/staging/most/Kconfig
+++ b/drivers/staging/most/Kconfig
@@ -21,7 +21,7 @@ source "drivers/staging/most/cdev/Kconfig"
 
 source "drivers/staging/most/net/Kconfig"
 
-source "drivers/staging/most/aim-sound/Kconfig"
+source "drivers/staging/most/sound/Kconfig"
 
 source "drivers/staging/most/aim-v4l2/Kconfig"
 
diff --git a/drivers/staging/most/aim-sound/Kconfig b/drivers/staging/most/sound/Kconfig
similarity index 72%
rename from drivers/staging/most/aim-sound/Kconfig
rename to drivers/staging/most/sound/Kconfig
index 3194c21..115262a 100644
--- a/drivers/staging/most/aim-sound/Kconfig
+++ b/drivers/staging/most/sound/Kconfig
@@ -2,12 +2,12 @@
 # MOST ALSA configuration
 #
 
-config AIM_SOUND
-	tristate "ALSA AIM"
+config MOST_SOUND
+	tristate "Sound"
 	depends on SND
 	select SND_PCM
 	---help---
 	  Say Y here if you want to commumicate via ALSA/sound devices.
 
 	  To compile this driver as a module, choose M here: the
-	  module will be called aim_sound.
+	  module will be called most_sound.
diff --git a/drivers/staging/most/sound/Makefile b/drivers/staging/most/sound/Makefile
new file mode 100644
index 0000000..eee8774
--- /dev/null
+++ b/drivers/staging/most/sound/Makefile
@@ -0,0 +1,4 @@
+obj-$(CONFIG_MOST_SOUND) += most_sound.o
+
+most_sound-objs := sound.o
+ccflags-y += -Idrivers/staging/
diff --git a/drivers/staging/most/aim-sound/sound.c b/drivers/staging/most/sound/sound.c
similarity index 100%
rename from drivers/staging/most/aim-sound/sound.c
rename to drivers/staging/most/sound/sound.c
-- 
2.7.4

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

* [PATCH 07/50] staging: most: usb: rename module
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (5 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 06/50] staging: most: sound: " Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 08/50] staging: most: video: " Christian Gromm
                   ` (44 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the folder of the usb module. It is needed
to clean up the  directory layout of the driver.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/Kconfig                          | 2 +-
 drivers/staging/most/{hdm-usb => usb}/Kconfig         | 7 +++----
 drivers/staging/most/usb/Makefile                     | 4 ++++
 drivers/staging/most/{hdm-usb/hdm_usb.c => usb/usb.c} | 2 +-
 4 files changed, 9 insertions(+), 6 deletions(-)
 rename drivers/staging/most/{hdm-usb => usb}/Kconfig (77%)
 create mode 100644 drivers/staging/most/usb/Makefile
 rename drivers/staging/most/{hdm-usb/hdm_usb.c => usb/usb.c} (99%)

diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig
index 3f12711..86d4f12 100644
--- a/drivers/staging/most/Kconfig
+++ b/drivers/staging/most/Kconfig
@@ -29,6 +29,6 @@ source "drivers/staging/most/dim2/Kconfig"
 
 source "drivers/staging/most/i2c/Kconfig"
 
-source "drivers/staging/most/hdm-usb/Kconfig"
+source "drivers/staging/most/usb/Kconfig"
 
 endif
diff --git a/drivers/staging/most/hdm-usb/Kconfig b/drivers/staging/most/usb/Kconfig
similarity index 77%
rename from drivers/staging/most/hdm-usb/Kconfig
rename to drivers/staging/most/usb/Kconfig
index 487f1f3..ebbdb57 100644
--- a/drivers/staging/most/hdm-usb/Kconfig
+++ b/drivers/staging/most/usb/Kconfig
@@ -2,13 +2,12 @@
 # MOST USB configuration
 #
 
-config HDM_USB
-	tristate "USB HDM"
+config MOST_USB
+	tristate "USB"
 	depends on USB && NET
-
 	---help---
 	  Say Y here if you want to connect via USB to network tranceiver.
 	  This device driver depends on the networking AIM.
 
 	  To compile this driver as a module, choose M here: the
-	  module will be called hdm_usb.
+	  module will be called most_usb.
diff --git a/drivers/staging/most/usb/Makefile b/drivers/staging/most/usb/Makefile
new file mode 100644
index 0000000..18d28cb
--- /dev/null
+++ b/drivers/staging/most/usb/Makefile
@@ -0,0 +1,4 @@
+obj-$(CONFIG_MOST_USB) += most_usb.o
+
+most_usb-objs := usb.o
+ccflags-y += -Idrivers/staging/
diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/usb/usb.c
similarity index 99%
rename from drivers/staging/most/hdm-usb/hdm_usb.c
rename to drivers/staging/most/usb/usb.c
index 5734e541..492480d 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -1,5 +1,5 @@
 /*
- * hdm_usb.c - Hardware dependent module for USB
+ * usb.c - Hardware dependent module for USB
  *
  * Copyright (C) 2013-2015 Microchip Technology Germany II GmbH & Co. KG
  *
-- 
2.7.4

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

* [PATCH 08/50] staging: most: video: rename module
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (6 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 07/50] staging: most: usb: " Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-24 15:08   ` Greg KH
  2017-11-21 14:04 ` [PATCH 09/50] staging: most: remove proprietary kobjects Christian Gromm
                   ` (43 subsequent siblings)
  51 siblings, 1 reply; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the folder of the video module. It is needed
to clean up the directory layout of the driver.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/Kconfig                     | 2 +-
 drivers/staging/most/{aim-v4l2 => video}/Kconfig | 6 +++---
 drivers/staging/most/video/Makefile              | 4 ++++
 drivers/staging/most/{aim-v4l2 => video}/video.c | 0
 4 files changed, 8 insertions(+), 4 deletions(-)
 rename drivers/staging/most/{aim-v4l2 => video}/Kconfig (71%)
 create mode 100644 drivers/staging/most/video/Makefile
 rename drivers/staging/most/{aim-v4l2 => video}/video.c (100%)

diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig
index 86d4f12..20047ab 100644
--- a/drivers/staging/most/Kconfig
+++ b/drivers/staging/most/Kconfig
@@ -23,7 +23,7 @@ source "drivers/staging/most/net/Kconfig"
 
 source "drivers/staging/most/sound/Kconfig"
 
-source "drivers/staging/most/aim-v4l2/Kconfig"
+source "drivers/staging/most/video/Kconfig"
 
 source "drivers/staging/most/dim2/Kconfig"
 
diff --git a/drivers/staging/most/aim-v4l2/Kconfig b/drivers/staging/most/video/Kconfig
similarity index 71%
rename from drivers/staging/most/aim-v4l2/Kconfig
rename to drivers/staging/most/video/Kconfig
index d70eaaf..ce6af4f 100644
--- a/drivers/staging/most/aim-v4l2/Kconfig
+++ b/drivers/staging/most/video/Kconfig
@@ -2,11 +2,11 @@
 # MOST V4L2 configuration
 #
 
-config AIM_V4L2
-	tristate "V4L2 AIM"
+config MOST_VIDEO
+	tristate "Video"
 	depends on VIDEO_V4L2
 	---help---
 	  Say Y here if you want to commumicate via Video 4 Linux.
 
 	  To compile this driver as a module, choose M here: the
-	  module will be called aim_v4l2.
\ No newline at end of file
+	  module will be called most_video.
diff --git a/drivers/staging/most/video/Makefile b/drivers/staging/most/video/Makefile
new file mode 100644
index 0000000..1c8e520
--- /dev/null
+++ b/drivers/staging/most/video/Makefile
@@ -0,0 +1,4 @@
+obj-$(CONFIG_MOST_VIDEO) += most_video.o
+
+most_video-objs := video.o
+ccflags-y += -Idrivers/staging/
diff --git a/drivers/staging/most/aim-v4l2/video.c b/drivers/staging/most/video/video.c
similarity index 100%
rename from drivers/staging/most/aim-v4l2/video.c
rename to drivers/staging/most/video/video.c
-- 
2.7.4

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

* [PATCH 09/50] staging: most: remove proprietary kobjects
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (7 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 08/50] staging: most: video: " Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-24 15:19   ` Greg KH
  2017-11-21 14:04 ` [PATCH 10/50] staging: most: core: remove function get_channel_by_iface Christian Gromm
                   ` (42 subsequent siblings)
  51 siblings, 1 reply; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch removes the proprietary kobjects used by the driver modules and
replaces them with device structs. The patch is needed to have the driver
being integrated into the kernel's device model.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/cdev/cdev.c   |   6 +-
 drivers/staging/most/core.c        | 803 +++++++++++--------------------------
 drivers/staging/most/core.h        |  13 +-
 drivers/staging/most/dim2/dim2.c   |  19 +-
 drivers/staging/most/dim2/sysfs.c  |  92 +----
 drivers/staging/most/dim2/sysfs.h  |   6 +-
 drivers/staging/most/i2c/i2c.c     |   7 +-
 drivers/staging/most/net/net.c     |   3 +-
 drivers/staging/most/sound/sound.c |   3 +-
 drivers/staging/most/usb/usb.c     | 243 +++--------
 drivers/staging/most/video/video.c |   3 +-
 11 files changed, 342 insertions(+), 856 deletions(-)

diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c
index b6849c8..c6baa9c 100644
--- a/drivers/staging/most/cdev/cdev.c
+++ b/drivers/staging/most/cdev/cdev.c
@@ -418,7 +418,6 @@ static int aim_tx_completion(struct most_interface *iface, int channel_id)
  * @iface: pointer to interface instance
  * @channel_id: channel index/ID
  * @cfg: pointer to actual channel configuration
- * @parent: pointer to kobject (needed for sysfs hook-up)
  * @name: name of the device to be created
  *
  * This allocates achannel object and creates the device node in /dev
@@ -426,15 +425,14 @@ static int aim_tx_completion(struct most_interface *iface, int channel_id)
  * Returns 0 on success or error code otherwise.
  */
 static int aim_probe(struct most_interface *iface, int channel_id,
-		     struct most_channel_config *cfg,
-		     struct kobject *parent, char *name)
+		     struct most_channel_config *cfg, char *name)
 {
 	struct aim_channel *c;
 	unsigned long cl_flags;
 	int retval;
 	int current_minor;
 
-	if ((!iface) || (!cfg) || (!parent) || (!name)) {
+	if ((!iface) || (!cfg) || (!name)) {
 		pr_info("Probing AIM with bad arguments");
 		return -EINVAL;
 	}
diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 6ee6acf..8c9b10d 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -33,7 +33,7 @@
 #define STRING_SIZE	80
 
 static struct class *most_class;
-static struct device *core_dev;
+static struct device core_dev;
 static struct ida mdev_id;
 static int dummy_num_buffers;
 
@@ -44,7 +44,7 @@ struct most_c_aim_obj {
 };
 
 struct most_c_obj {
-	struct kobject kobj;
+	struct device dev;
 	struct completion cleanup;
 	atomic_t mbo_ref;
 	atomic_t mbo_nq_level;
@@ -69,14 +69,13 @@ struct most_c_obj {
 	wait_queue_head_t hdm_fifo_wq;
 };
 
-#define to_c_obj(d) container_of(d, struct most_c_obj, kobj)
+#define to_c_obj(d) container_of(d, struct most_c_obj, dev)
 
 struct most_inst_obj {
 	int dev_id;
 	struct most_interface *iface;
 	struct list_head channel_list;
 	struct most_c_obj *channel[MAX_CHANNELS];
-	struct kobject kobj;
 	struct list_head list;
 };
 
@@ -91,8 +90,6 @@ static const struct {
 	{ MOST_CH_ISOC, "isoc_avp\n"},
 };
 
-#define to_inst_obj(d) container_of(d, struct most_inst_obj, kobj)
-
 /**
  * list_pop_mbo - retrieves the first MBO of the list and removes it
  * @ptr: the list head to grab the MBO from.
@@ -109,68 +106,6 @@ static const struct {
  */
 
 /**
- * struct most_c_attr - to access the attributes of a channel object
- * @attr: attributes of a channel
- * @show: pointer to the show function
- * @store: pointer to the store function
- */
-struct most_c_attr {
-	struct attribute attr;
-	ssize_t (*show)(struct most_c_obj *d,
-			struct most_c_attr *attr,
-			char *buf);
-	ssize_t (*store)(struct most_c_obj *d,
-			 struct most_c_attr *attr,
-			 const char *buf,
-			 size_t count);
-};
-
-#define to_channel_attr(a) container_of(a, struct most_c_attr, attr)
-
-/**
- * channel_attr_show - show function of channel object
- * @kobj: pointer to its kobject
- * @attr: pointer to its attributes
- * @buf: buffer
- */
-static ssize_t channel_attr_show(struct kobject *kobj, struct attribute *attr,
-				 char *buf)
-{
-	struct most_c_attr *channel_attr = to_channel_attr(attr);
-	struct most_c_obj *c_obj = to_c_obj(kobj);
-
-	if (!channel_attr->show)
-		return -EIO;
-
-	return channel_attr->show(c_obj, channel_attr, buf);
-}
-
-/**
- * channel_attr_store - store function of channel object
- * @kobj: pointer to its kobject
- * @attr: pointer to its attributes
- * @buf: buffer
- * @len: length of buffer
- */
-static ssize_t channel_attr_store(struct kobject *kobj,
-				  struct attribute *attr,
-				  const char *buf,
-				  size_t len)
-{
-	struct most_c_attr *channel_attr = to_channel_attr(attr);
-	struct most_c_obj *c_obj = to_c_obj(kobj);
-
-	if (!channel_attr->store)
-		return -EIO;
-	return channel_attr->store(c_obj, channel_attr, buf, len);
-}
-
-static const struct sysfs_ops most_channel_sysfs_ops = {
-	.show = channel_attr_show,
-	.store = channel_attr_store,
-};
-
-/**
  * most_free_mbo_coherent - free an MBO and its coherent buffer
  * @mbo: buffer to be released
  *
@@ -241,21 +176,11 @@ static int flush_trash_fifo(struct most_c_obj *c)
 	return 0;
 }
 
-/**
- * most_channel_release - release function of channel object
- * @kobj: pointer to channel's kobject
- */
-static void most_channel_release(struct kobject *kobj)
-{
-	struct most_c_obj *c = to_c_obj(kobj);
-
-	kfree(c);
-}
-
-static ssize_t available_directions_show(struct most_c_obj *c,
-					 struct most_c_attr *attr,
+static ssize_t available_directions_show(struct device *dev,
+					 struct device_attribute *attr,
 					 char *buf)
 {
+	struct most_c_obj *c = to_c_obj(dev);
 	unsigned int i = c->channel_id;
 
 	strcpy(buf, "");
@@ -267,10 +192,11 @@ static ssize_t available_directions_show(struct most_c_obj *c,
 	return strlen(buf);
 }
 
-static ssize_t available_datatypes_show(struct most_c_obj *c,
-					struct most_c_attr *attr,
+static ssize_t available_datatypes_show(struct device *dev,
+					struct device_attribute *attr,
 					char *buf)
 {
+	struct most_c_obj *c = to_c_obj(dev);
 	unsigned int i = c->channel_id;
 
 	strcpy(buf, "");
@@ -286,65 +212,75 @@ static ssize_t available_datatypes_show(struct most_c_obj *c,
 	return strlen(buf);
 }
 
-static ssize_t number_of_packet_buffers_show(struct most_c_obj *c,
-					     struct most_c_attr *attr,
+static ssize_t number_of_packet_buffers_show(struct device *dev,
+					     struct device_attribute *attr,
 					     char *buf)
 {
+	struct most_c_obj *c = to_c_obj(dev);
 	unsigned int i = c->channel_id;
 
 	return snprintf(buf, PAGE_SIZE, "%d\n",
 			c->iface->channel_vector[i].num_buffers_packet);
 }
 
-static ssize_t number_of_stream_buffers_show(struct most_c_obj *c,
-					     struct most_c_attr *attr,
+static ssize_t number_of_stream_buffers_show(struct device *dev,
+					     struct device_attribute *attr,
 					     char *buf)
 {
+	struct most_c_obj *c = to_c_obj(dev);
 	unsigned int i = c->channel_id;
 
 	return snprintf(buf, PAGE_SIZE, "%d\n",
 			c->iface->channel_vector[i].num_buffers_streaming);
 }
 
-static ssize_t size_of_packet_buffer_show(struct most_c_obj *c,
-					  struct most_c_attr *attr,
+static ssize_t size_of_packet_buffer_show(struct device *dev,
+					  struct device_attribute *attr,
 					  char *buf)
 {
+	struct most_c_obj *c = to_c_obj(dev);
 	unsigned int i = c->channel_id;
 
 	return snprintf(buf, PAGE_SIZE, "%d\n",
 			c->iface->channel_vector[i].buffer_size_packet);
 }
 
-static ssize_t size_of_stream_buffer_show(struct most_c_obj *c,
-					  struct most_c_attr *attr,
+static ssize_t size_of_stream_buffer_show(struct device *dev,
+					  struct device_attribute *attr,
 					  char *buf)
 {
+	struct most_c_obj *c = to_c_obj(dev);
 	unsigned int i = c->channel_id;
 
 	return snprintf(buf, PAGE_SIZE, "%d\n",
 			c->iface->channel_vector[i].buffer_size_streaming);
 }
 
-static ssize_t channel_starving_show(struct most_c_obj *c,
-				     struct most_c_attr *attr,
+static ssize_t channel_starving_show(struct device *dev,
+				     struct device_attribute *attr,
 				     char *buf)
 {
+	struct most_c_obj *c = to_c_obj(dev);
+
 	return snprintf(buf, PAGE_SIZE, "%d\n", c->is_starving);
 }
 
-static ssize_t set_number_of_buffers_show(struct most_c_obj *c,
-					  struct most_c_attr *attr,
+static ssize_t set_number_of_buffers_show(struct device *dev,
+					  struct device_attribute *attr,
 					  char *buf)
 {
+	struct most_c_obj *c = to_c_obj(dev);
+
 	return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.num_buffers);
 }
 
-static ssize_t set_number_of_buffers_store(struct most_c_obj *c,
-					   struct most_c_attr *attr,
+static ssize_t set_number_of_buffers_store(struct device *dev,
+					   struct device_attribute *attr,
 					   const char *buf,
 					   size_t count)
 {
+	struct most_c_obj *c = to_c_obj(dev);
+
 	int ret = kstrtou16(buf, 0, &c->cfg.num_buffers);
 
 	if (ret)
@@ -352,18 +288,21 @@ static ssize_t set_number_of_buffers_store(struct most_c_obj *c,
 	return count;
 }
 
-static ssize_t set_buffer_size_show(struct most_c_obj *c,
-				    struct most_c_attr *attr,
+static ssize_t set_buffer_size_show(struct device *dev,
+				    struct device_attribute *attr,
 				    char *buf)
 {
+	struct most_c_obj *c = to_c_obj(dev);
+
 	return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.buffer_size);
 }
 
-static ssize_t set_buffer_size_store(struct most_c_obj *c,
-				     struct most_c_attr *attr,
+static ssize_t set_buffer_size_store(struct device *dev,
+				     struct device_attribute *attr,
 				     const char *buf,
 				     size_t count)
 {
+	struct most_c_obj *c = to_c_obj(dev);
 	int ret = kstrtou16(buf, 0, &c->cfg.buffer_size);
 
 	if (ret)
@@ -371,10 +310,12 @@ static ssize_t set_buffer_size_store(struct most_c_obj *c,
 	return count;
 }
 
-static ssize_t set_direction_show(struct most_c_obj *c,
-				  struct most_c_attr *attr,
+static ssize_t set_direction_show(struct device *dev,
+				  struct device_attribute *attr,
 				  char *buf)
 {
+	struct most_c_obj *c = to_c_obj(dev);
+
 	if (c->cfg.direction & MOST_CH_TX)
 		return snprintf(buf, PAGE_SIZE, "tx\n");
 	else if (c->cfg.direction & MOST_CH_RX)
@@ -382,11 +323,13 @@ static ssize_t set_direction_show(struct most_c_obj *c,
 	return snprintf(buf, PAGE_SIZE, "unconfigured\n");
 }
 
-static ssize_t set_direction_store(struct most_c_obj *c,
-				   struct most_c_attr *attr,
+static ssize_t set_direction_store(struct device *dev,
+				   struct device_attribute *attr,
 				   const char *buf,
 				   size_t count)
 {
+	struct most_c_obj *c = to_c_obj(dev);
+
 	if (!strcmp(buf, "dir_rx\n")) {
 		c->cfg.direction = MOST_CH_RX;
 	} else if (!strcmp(buf, "rx\n")) {
@@ -402,11 +345,12 @@ static ssize_t set_direction_store(struct most_c_obj *c,
 	return count;
 }
 
-static ssize_t set_datatype_show(struct most_c_obj *c,
-				 struct most_c_attr *attr,
+static ssize_t set_datatype_show(struct device *dev,
+				 struct device_attribute *attr,
 				 char *buf)
 {
 	int i;
+	struct most_c_obj *c = to_c_obj(dev);
 
 	for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
 		if (c->cfg.data_type & ch_data_type[i].most_ch_data_type)
@@ -415,12 +359,13 @@ static ssize_t set_datatype_show(struct most_c_obj *c,
 	return snprintf(buf, PAGE_SIZE, "unconfigured\n");
 }
 
-static ssize_t set_datatype_store(struct most_c_obj *c,
-				  struct most_c_attr *attr,
+static ssize_t set_datatype_store(struct device *dev,
+				  struct device_attribute *attr,
 				  const char *buf,
 				  size_t count)
 {
 	int i;
+	struct most_c_obj *c = to_c_obj(dev);
 
 	for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
 		if (!strcmp(buf, ch_data_type[i].name)) {
@@ -436,18 +381,21 @@ static ssize_t set_datatype_store(struct most_c_obj *c,
 	return count;
 }
 
-static ssize_t set_subbuffer_size_show(struct most_c_obj *c,
-				       struct most_c_attr *attr,
+static ssize_t set_subbuffer_size_show(struct device *dev,
+				       struct device_attribute *attr,
 				       char *buf)
 {
+	struct most_c_obj *c = to_c_obj(dev);
+
 	return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.subbuffer_size);
 }
 
-static ssize_t set_subbuffer_size_store(struct most_c_obj *c,
-					struct most_c_attr *attr,
+static ssize_t set_subbuffer_size_store(struct device *dev,
+					struct device_attribute *attr,
 					const char *buf,
 					size_t count)
 {
+	struct most_c_obj *c = to_c_obj(dev);
 	int ret = kstrtou16(buf, 0, &c->cfg.subbuffer_size);
 
 	if (ret)
@@ -455,18 +403,21 @@ static ssize_t set_subbuffer_size_store(struct most_c_obj *c,
 	return count;
 }
 
-static ssize_t set_packets_per_xact_show(struct most_c_obj *c,
-					 struct most_c_attr *attr,
+static ssize_t set_packets_per_xact_show(struct device *dev,
+					 struct device_attribute *attr,
 					 char *buf)
 {
+	struct most_c_obj *c = to_c_obj(dev);
+
 	return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.packets_per_xact);
 }
 
-static ssize_t set_packets_per_xact_store(struct most_c_obj *c,
-					  struct most_c_attr *attr,
+static ssize_t set_packets_per_xact_store(struct device *dev,
+					  struct device_attribute *attr,
 					  const char *buf,
 					  size_t count)
 {
+	struct most_c_obj *c = to_c_obj(dev);
 	int ret = kstrtou16(buf, 0, &c->cfg.packets_per_xact);
 
 	if (ret)
@@ -474,77 +425,47 @@ static ssize_t set_packets_per_xact_store(struct most_c_obj *c,
 	return count;
 }
 
-static struct most_c_attr most_c_attrs[] = {
-	__ATTR_RO(available_directions),
-	__ATTR_RO(available_datatypes),
-	__ATTR_RO(number_of_packet_buffers),
-	__ATTR_RO(number_of_stream_buffers),
-	__ATTR_RO(size_of_stream_buffer),
-	__ATTR_RO(size_of_packet_buffer),
-	__ATTR_RO(channel_starving),
-	__ATTR_RW(set_buffer_size),
-	__ATTR_RW(set_number_of_buffers),
-	__ATTR_RW(set_direction),
-	__ATTR_RW(set_datatype),
-	__ATTR_RW(set_subbuffer_size),
-	__ATTR_RW(set_packets_per_xact),
-};
-
-/**
- * most_channel_def_attrs - array of default attributes of channel object
- */
-static struct attribute *most_channel_def_attrs[] = {
-	&most_c_attrs[0].attr,
-	&most_c_attrs[1].attr,
-	&most_c_attrs[2].attr,
-	&most_c_attrs[3].attr,
-	&most_c_attrs[4].attr,
-	&most_c_attrs[5].attr,
-	&most_c_attrs[6].attr,
-	&most_c_attrs[7].attr,
-	&most_c_attrs[8].attr,
-	&most_c_attrs[9].attr,
-	&most_c_attrs[10].attr,
-	&most_c_attrs[11].attr,
-	&most_c_attrs[12].attr,
+#define DEV_ATTR(_name)  (&dev_attr_##_name.attr)
+
+static DEVICE_ATTR_RO(available_directions);
+static DEVICE_ATTR_RO(available_datatypes);
+static DEVICE_ATTR_RO(number_of_packet_buffers);
+static DEVICE_ATTR_RO(number_of_stream_buffers);
+static DEVICE_ATTR_RO(size_of_stream_buffer);
+static DEVICE_ATTR_RO(size_of_packet_buffer);
+static DEVICE_ATTR_RO(channel_starving);
+static DEVICE_ATTR_RW(set_buffer_size);
+static DEVICE_ATTR_RW(set_number_of_buffers);
+static DEVICE_ATTR_RW(set_direction);
+static DEVICE_ATTR_RW(set_datatype);
+static DEVICE_ATTR_RW(set_subbuffer_size);
+static DEVICE_ATTR_RW(set_packets_per_xact);
+
+static struct attribute *channel_attrs[] = {
+	DEV_ATTR(available_directions),
+	DEV_ATTR(available_datatypes),
+	DEV_ATTR(number_of_packet_buffers),
+	DEV_ATTR(number_of_stream_buffers),
+	DEV_ATTR(size_of_stream_buffer),
+	DEV_ATTR(size_of_packet_buffer),
+	DEV_ATTR(channel_starving),
+	DEV_ATTR(set_buffer_size),
+	DEV_ATTR(set_number_of_buffers),
+	DEV_ATTR(set_direction),
+	DEV_ATTR(set_datatype),
+	DEV_ATTR(set_subbuffer_size),
+	DEV_ATTR(set_packets_per_xact),
 	NULL,
 };
 
-static struct kobj_type most_channel_ktype = {
-	.sysfs_ops = &most_channel_sysfs_ops,
-	.release = most_channel_release,
-	.default_attrs = most_channel_def_attrs,
+static struct attribute_group channel_attr_group = {
+	.attrs = channel_attrs,
 };
 
-static struct kset *most_channel_kset;
-
-/**
- * create_most_c_obj - allocates a channel object
- * @name: name of the channel object
- * @parent: parent kobject
- *
- * This create a channel object and registers it with sysfs.
- * Returns a pointer to the object or NULL when something went wrong.
- */
-static struct most_c_obj *
-create_most_c_obj(const char *name, struct kobject *parent)
-{
-	struct most_c_obj *c;
-	int retval;
-
-	c = kzalloc(sizeof(*c), GFP_KERNEL);
-	if (!c)
-		return NULL;
-	c->kobj.kset = most_channel_kset;
-	retval = kobject_init_and_add(&c->kobj, &most_channel_ktype, parent,
-				      "%s", name);
-	if (retval) {
-		kobject_put(&c->kobj);
-		return NULL;
-	}
-	kobject_uevent(&c->kobj, KOBJ_ADD);
-	return c;
-}
+static const struct attribute_group *channel_attr_groups[] = {
+	&channel_attr_group,
+	NULL,
+};
 
 /*		     ___	       ___
  *		     ___I N S T A N C E___
@@ -552,103 +473,22 @@ create_most_c_obj(const char *name, struct kobject *parent)
 
 static struct list_head instance_list;
 
-/**
- * struct most_inst_attribute - to access the attributes of instance object
- * @attr: attributes of an instance
- * @show: pointer to the show function
- * @store: pointer to the store function
- */
-struct most_inst_attribute {
-	struct attribute attr;
-	ssize_t (*show)(struct most_inst_obj *d,
-			struct most_inst_attribute *attr,
-			char *buf);
-	ssize_t (*store)(struct most_inst_obj *d,
-			 struct most_inst_attribute *attr,
-			 const char *buf,
-			 size_t count);
-};
-
-#define to_instance_attr(a) \
-	container_of(a, struct most_inst_attribute, attr)
-
-/**
- * instance_attr_show - show function for an instance object
- * @kobj: pointer to kobject
- * @attr: pointer to attribute struct
- * @buf: buffer
- */
-static ssize_t instance_attr_show(struct kobject *kobj,
-				  struct attribute *attr,
-				  char *buf)
-{
-	struct most_inst_attribute *instance_attr;
-	struct most_inst_obj *instance_obj;
-
-	instance_attr = to_instance_attr(attr);
-	instance_obj = to_inst_obj(kobj);
-
-	if (!instance_attr->show)
-		return -EIO;
-
-	return instance_attr->show(instance_obj, instance_attr, buf);
-}
-
-/**
- * instance_attr_store - store function for an instance object
- * @kobj: pointer to kobject
- * @attr: pointer to attribute struct
- * @buf: buffer
- * @len: length of buffer
- */
-static ssize_t instance_attr_store(struct kobject *kobj,
-				   struct attribute *attr,
-				   const char *buf,
-				   size_t len)
-{
-	struct most_inst_attribute *instance_attr;
-	struct most_inst_obj *instance_obj;
-
-	instance_attr = to_instance_attr(attr);
-	instance_obj = to_inst_obj(kobj);
-
-	if (!instance_attr->store)
-		return -EIO;
-
-	return instance_attr->store(instance_obj, instance_attr, buf, len);
-}
-
-static const struct sysfs_ops most_inst_sysfs_ops = {
-	.show = instance_attr_show,
-	.store = instance_attr_store,
-};
-
-/**
- * most_inst_release - release function for instance object
- * @kobj: pointer to instance's kobject
- *
- * This frees the allocated memory for the instance object
- */
-static void most_inst_release(struct kobject *kobj)
-{
-	struct most_inst_obj *inst = to_inst_obj(kobj);
-
-	kfree(inst);
-}
-
-static ssize_t description_show(struct most_inst_obj *instance_obj,
-				struct most_inst_attribute *attr,
+static ssize_t description_show(struct device *dev,
+				struct device_attribute *attr,
 				char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%s\n",
-			instance_obj->iface->description);
+	struct most_interface *iface = to_most_interface(dev);
+
+	return snprintf(buf, PAGE_SIZE, "%s\n", iface->description);
 }
 
-static ssize_t interface_show(struct most_inst_obj *instance_obj,
-			      struct most_inst_attribute *attr,
+static ssize_t interface_show(struct device *dev,
+			      struct device_attribute *attr,
 			      char *buf)
 {
-	switch (instance_obj->iface->interface) {
+	struct most_interface *iface = to_most_interface(dev);
+
+	switch (iface->interface) {
 	case ITYPE_LOOPBACK:
 		return snprintf(buf, PAGE_SIZE, "loopback\n");
 	case ITYPE_I2C:
@@ -671,182 +511,42 @@ static ssize_t interface_show(struct most_inst_obj *instance_obj,
 	return snprintf(buf, PAGE_SIZE, "unknown\n");
 }
 
-static struct most_inst_attribute most_inst_attr_description =
-	__ATTR_RO(description);
-
-static struct most_inst_attribute most_inst_attr_interface =
-	__ATTR_RO(interface);
+static DEVICE_ATTR_RO(description);
+static DEVICE_ATTR_RO(interface);
 
-static struct attribute *most_inst_def_attrs[] = {
-	&most_inst_attr_description.attr,
-	&most_inst_attr_interface.attr,
+static struct attribute *interface_attrs[] = {
+	DEV_ATTR(description),
+	DEV_ATTR(interface),
 	NULL,
 };
 
-static struct kobj_type most_inst_ktype = {
-	.sysfs_ops = &most_inst_sysfs_ops,
-	.release = most_inst_release,
-	.default_attrs = most_inst_def_attrs,
+static struct attribute_group interface_attr_group = {
+	.attrs = interface_attrs,
 };
 
-static struct kset *most_inst_kset;
-
-/**
- * create_most_inst_obj - creates an instance object
- * @name: name of the object to be created
- *
- * This allocates memory for an instance structure, assigns the proper kset
- * and registers it with sysfs.
- *
- * Returns a pointer to the instance object or NULL when something went wrong.
- */
-static struct most_inst_obj *create_most_inst_obj(const char *name)
-{
-	struct most_inst_obj *inst;
-	int retval;
-
-	inst = kzalloc(sizeof(*inst), GFP_KERNEL);
-	if (!inst)
-		return NULL;
-	inst->kobj.kset = most_inst_kset;
-	retval = kobject_init_and_add(&inst->kobj, &most_inst_ktype, NULL,
-				      "%s", name);
-	if (retval) {
-		kobject_put(&inst->kobj);
-		return NULL;
-	}
-	kobject_uevent(&inst->kobj, KOBJ_ADD);
-	return inst;
-}
-
-/**
- * destroy_most_inst_obj - MOST instance release function
- * @inst: pointer to the instance object
- *
- * This decrements the reference counter of the instance object.
- * If the reference count turns zero, its release function is called
- */
-static void destroy_most_inst_obj(struct most_inst_obj *inst)
-{
-	struct most_c_obj *c, *tmp;
-
-	list_for_each_entry_safe(c, tmp, &inst->channel_list, list) {
-		flush_trash_fifo(c);
-		flush_channel_fifos(c);
-		kobject_put(&c->kobj);
-	}
-	kobject_put(&inst->kobj);
-}
+static const struct attribute_group *interface_attr_groups[] = {
+	&interface_attr_group,
+	NULL,
+};
 
 /*		     ___     ___
  *		     ___A I M___
  */
-struct most_aim_obj {
-	struct kobject kobj;
-	struct list_head list;
-	struct most_aim *driver;
-};
-
-#define to_aim_obj(d) container_of(d, struct most_aim_obj, kobj)
-
-static struct list_head aim_list;
-
-/**
- * struct most_aim_attribute - to access the attributes of AIM object
- * @attr: attributes of an AIM
- * @show: pointer to the show function
- * @store: pointer to the store function
- */
-struct most_aim_attribute {
-	struct attribute attr;
-	ssize_t (*show)(struct most_aim_obj *d,
-			struct most_aim_attribute *attr,
-			char *buf);
-	ssize_t (*store)(struct most_aim_obj *d,
-			 struct most_aim_attribute *attr,
-			 const char *buf,
-			 size_t count);
-};
-
-#define to_aim_attr(a) container_of(a, struct most_aim_attribute, attr)
-
-/**
- * aim_attr_show - show function of an AIM object
- * @kobj: pointer to kobject
- * @attr: pointer to attribute struct
- * @buf: buffer
- */
-static ssize_t aim_attr_show(struct kobject *kobj,
-			     struct attribute *attr,
-			     char *buf)
-{
-	struct most_aim_attribute *aim_attr;
-	struct most_aim_obj *aim_obj;
-
-	aim_attr = to_aim_attr(attr);
-	aim_obj = to_aim_obj(kobj);
-
-	if (!aim_attr->show)
-		return -EIO;
-
-	return aim_attr->show(aim_obj, aim_attr, buf);
-}
-
-/**
- * aim_attr_store - store function of an AIM object
- * @kobj: pointer to kobject
- * @attr: pointer to attribute struct
- * @buf: buffer
- * @len: length of buffer
- */
-static ssize_t aim_attr_store(struct kobject *kobj,
-			      struct attribute *attr,
-			      const char *buf,
-			      size_t len)
-{
-	struct most_aim_attribute *aim_attr;
-	struct most_aim_obj *aim_obj;
-
-	aim_attr = to_aim_attr(attr);
-	aim_obj = to_aim_obj(kobj);
-
-	if (!aim_attr->store)
-		return -EIO;
-	return aim_attr->store(aim_obj, aim_attr, buf, len);
-}
-
-static const struct sysfs_ops most_aim_sysfs_ops = {
-	.show = aim_attr_show,
-	.store = aim_attr_store,
-};
-
-/**
- * most_aim_release - AIM release function
- * @kobj: pointer to AIM's kobject
- */
-static void most_aim_release(struct kobject *kobj)
-{
-	struct most_aim_obj *aim_obj = to_aim_obj(kobj);
-
-	kfree(aim_obj);
-}
-
-static ssize_t links_show(struct most_aim_obj *aim_obj,
-			  struct most_aim_attribute *attr,
+static ssize_t links_show(struct device *dev, struct device_attribute *attr,
 			  char *buf)
 {
 	struct most_c_obj *c;
 	struct most_inst_obj *i;
+	struct most_aim *aim = to_most_aim(dev);
 	int offs = 0;
 
 	list_for_each_entry(i, &instance_list, list) {
 		list_for_each_entry(c, &i->channel_list, list) {
-			if (c->aim0.ptr == aim_obj->driver ||
-			    c->aim1.ptr == aim_obj->driver) {
+			if (c->aim0.ptr == aim || c->aim1.ptr == aim) {
 				offs += snprintf(buf + offs, PAGE_SIZE - offs,
 						 "%s:%s\n",
-						 kobject_name(&i->kobj),
-						 kobject_name(&c->kobj));
+						 dev_name(&i->iface->dev),
+						 dev_name(&c->dev));
 			}
 		}
 	}
@@ -907,7 +607,7 @@ most_c_obj *get_channel_by_name(char *mdev, char *mdev_ch)
 	int found = 0;
 
 	list_for_each_entry_safe(i, i_tmp, &instance_list, list) {
-		if (!strcmp(kobject_name(&i->kobj), mdev)) {
+		if (!strcmp(dev_name(&i->iface->dev), mdev)) {
 			found++;
 			break;
 		}
@@ -916,7 +616,7 @@ most_c_obj *get_channel_by_name(char *mdev, char *mdev_ch)
 		return ERR_PTR(-EIO);
 
 	list_for_each_entry_safe(c, tmp, &i->channel_list, list) {
-		if (!strcmp(kobject_name(&c->kobj), mdev_ch)) {
+		if (!strcmp(dev_name(&c->dev), mdev_ch)) {
 			found++;
 			break;
 		}
@@ -948,13 +648,14 @@ most_c_obj *get_channel_by_name(char *mdev, char *mdev_ch)
  * (1) would create the device node /dev/my_rxchannel
  * (2) would create the device node /dev/mdev1-ep81
  */
-static ssize_t add_link_store(struct most_aim_obj *aim_obj,
-			      struct most_aim_attribute *attr,
+static ssize_t add_link_store(struct device *dev,
+			      struct device_attribute *attr,
 			      const char *buf,
 			      size_t len)
 {
 	struct most_c_obj *c;
 	struct most_aim **aim_ptr;
+	struct most_aim *aim = to_most_aim(dev);
 	char buffer[STRING_SIZE];
 	char *mdev;
 	char *mdev_ch;
@@ -986,9 +687,8 @@ static ssize_t add_link_store(struct most_aim_obj *aim_obj,
 	else
 		return -ENOSPC;
 
-	*aim_ptr = aim_obj->driver;
-	ret = aim_obj->driver->probe_channel(c->iface, c->channel_id,
-					     &c->cfg, &c->kobj, mdev_devnod);
+	*aim_ptr = aim;
+	ret = aim->probe_channel(c->iface, c->channel_id, &c->cfg, mdev_devnod);
 	if (ret) {
 		*aim_ptr = NULL;
 		return ret;
@@ -1007,12 +707,13 @@ static ssize_t add_link_store(struct most_aim_obj *aim_obj,
  * Example:
  * echo "mdev0:ep81" >remove_link
  */
-static ssize_t remove_link_store(struct most_aim_obj *aim_obj,
-				 struct most_aim_attribute *attr,
+static ssize_t remove_link_store(struct device *dev,
+				 struct device_attribute *attr,
 				 const char *buf,
 				 size_t len)
 {
 	struct most_c_obj *c;
+	struct most_aim *aim = to_most_aim(dev);
 	char buffer[STRING_SIZE];
 	char *mdev;
 	char *mdev_ch;
@@ -1028,74 +729,34 @@ static ssize_t remove_link_store(struct most_aim_obj *aim_obj,
 	if (IS_ERR(c))
 		return -ENODEV;
 
-	if (aim_obj->driver->disconnect_channel(c->iface, c->channel_id))
+	if (aim->disconnect_channel(c->iface, c->channel_id))
 		return -EIO;
-	if (c->aim0.ptr == aim_obj->driver)
+	if (c->aim0.ptr == aim)
 		c->aim0.ptr = NULL;
-	if (c->aim1.ptr == aim_obj->driver)
+	if (c->aim1.ptr == aim)
 		c->aim1.ptr = NULL;
 	return len;
 }
 
-static struct most_aim_attribute most_aim_attrs[] = {
-	__ATTR_RO(links),
-	__ATTR_WO(add_link),
-	__ATTR_WO(remove_link),
-};
+static DEVICE_ATTR_RO(links);
+static DEVICE_ATTR_WO(add_link);
+static DEVICE_ATTR_WO(remove_link);
 
-static struct attribute *most_aim_def_attrs[] = {
-	&most_aim_attrs[0].attr,
-	&most_aim_attrs[1].attr,
-	&most_aim_attrs[2].attr,
+static struct attribute *aim_attrs[] = {
+	DEV_ATTR(links),
+	DEV_ATTR(add_link),
+	DEV_ATTR(remove_link),
 	NULL,
 };
 
-static struct kobj_type most_aim_ktype = {
-	.sysfs_ops = &most_aim_sysfs_ops,
-	.release = most_aim_release,
-	.default_attrs = most_aim_def_attrs,
+static struct attribute_group aim_attr_group = {
+	.attrs = aim_attrs,
 };
 
-static struct kset *most_aim_kset;
-
-/**
- * create_most_aim_obj - creates an AIM object
- * @name: name of the AIM
- *
- * This creates an AIM object assigns the proper kset and registers
- * it with sysfs.
- * Returns a pointer to the object or NULL if something went wrong.
- */
-static struct most_aim_obj *create_most_aim_obj(const char *name)
-{
-	struct most_aim_obj *most_aim;
-	int retval;
-
-	most_aim = kzalloc(sizeof(*most_aim), GFP_KERNEL);
-	if (!most_aim)
-		return NULL;
-	most_aim->kobj.kset = most_aim_kset;
-	retval = kobject_init_and_add(&most_aim->kobj, &most_aim_ktype,
-				      NULL, "%s", name);
-	if (retval) {
-		kobject_put(&most_aim->kobj);
-		return NULL;
-	}
-	kobject_uevent(&most_aim->kobj, KOBJ_ADD);
-	return most_aim;
-}
-
-/**
- * destroy_most_aim_obj - AIM release function
- * @p: pointer to AIM object
- *
- * This decrements the reference counter of the AIM object. If the
- * reference count turns zero, its release function will be called.
- */
-static void destroy_most_aim_obj(struct most_aim_obj *p)
-{
-	kobject_put(&p->kobj);
-}
+static const struct attribute_group *aim_attr_groups[] = {
+	&aim_attr_group,
+	NULL,
+};
 
 /*		     ___       ___
  *		     ___C O R E___
@@ -1621,28 +1282,35 @@ int most_stop_channel(struct most_interface *iface, int id,
 }
 EXPORT_SYMBOL_GPL(most_stop_channel);
 
+void release_aim(struct device *dev)
+{
+	pr_info("releasing aim %s\n", dev_name(dev));
+}
+
 /**
  * most_register_aim - registers an AIM (driver) with the core
  * @aim: instance of AIM to be registered
  */
 int most_register_aim(struct most_aim *aim)
 {
-	struct most_aim_obj *aim_obj;
+	int ret;
 
 	if (!aim) {
 		pr_err("Bad driver\n");
 		return -EINVAL;
 	}
-	aim_obj = create_most_aim_obj(aim->name);
-	if (!aim_obj) {
-		pr_info("failed to alloc driver object\n");
-		return -ENOMEM;
+	aim->dev.init_name = aim->name;
+	aim->dev.bus = &most_bus;
+	aim->dev.parent = &core_dev;
+	aim->dev.groups = aim_attr_groups;
+	aim->dev.release = release_aim;
+	ret = device_register(&aim->dev);
+	if (ret) {
+		pr_err("registering device %s failed\n", aim->name);
+		return ret;
 	}
-	aim_obj->driver = aim;
-	aim->context = aim_obj;
 	pr_info("registered new application interfacing module %s\n",
 		aim->name);
-	list_add_tail(&aim_obj->list, &aim_list);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(most_register_aim);
@@ -1653,7 +1321,6 @@ EXPORT_SYMBOL_GPL(most_register_aim);
  */
 int most_deregister_aim(struct most_aim *aim)
 {
-	struct most_aim_obj *aim_obj;
 	struct most_c_obj *c, *tmp;
 	struct most_inst_obj *i, *i_tmp;
 
@@ -1662,11 +1329,6 @@ int most_deregister_aim(struct most_aim *aim)
 		return -EINVAL;
 	}
 
-	aim_obj = aim->context;
-	if (!aim_obj) {
-		pr_info("driver not registered.\n");
-		return -EINVAL;
-	}
 	list_for_each_entry_safe(i, i_tmp, &instance_list, list) {
 		list_for_each_entry_safe(c, tmp, &i->channel_list, list) {
 			if (c->aim0.ptr == aim || c->aim1.ptr == aim)
@@ -1678,13 +1340,22 @@ int most_deregister_aim(struct most_aim *aim)
 				c->aim1.ptr = NULL;
 		}
 	}
-	list_del(&aim_obj->list);
-	destroy_most_aim_obj(aim_obj);
+	device_unregister(&aim->dev);
 	pr_info("deregistering application interfacing module %s\n", aim->name);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(most_deregister_aim);
 
+static void release_interface(struct device *dev)
+{
+	pr_info("releasing interface dev %s...\n", dev_name(dev));
+}
+
+static void release_channel(struct device *dev)
+{
+	pr_info("releasing channel dev %s...\n", dev_name(dev));
+}
+
 /**
  * most_register_interface - registers an interface with core
  * @iface: pointer to the instance of the interface description.
@@ -1692,7 +1363,7 @@ EXPORT_SYMBOL_GPL(most_deregister_aim);
  * Allocates and initializes a new interface instance and all of its channels.
  * Returns a pointer to kobject or an error pointer.
  */
-struct kobject *most_register_interface(struct most_interface *iface)
+int most_register_interface(struct most_interface *iface)
 {
 	unsigned int i;
 	int id;
@@ -1704,21 +1375,20 @@ struct kobject *most_register_interface(struct most_interface *iface)
 	if (!iface || !iface->enqueue || !iface->configure ||
 	    !iface->poison_channel || (iface->num_channels > MAX_CHANNELS)) {
 		pr_err("Bad interface or channel overflow\n");
-		return ERR_PTR(-EINVAL);
+		return -EINVAL;
 	}
 
 	id = ida_simple_get(&mdev_id, 0, 0, GFP_KERNEL);
 	if (id < 0) {
 		pr_info("Failed to alloc mdev ID\n");
-		return ERR_PTR(id);
+		return id;
 	}
-	snprintf(name, STRING_SIZE, "mdev%d", id);
 
-	inst = create_most_inst_obj(name);
+	inst = kzalloc(sizeof(*inst), GFP_KERNEL);
 	if (!inst) {
 		pr_info("Failed to allocate interface instance\n");
 		ida_simple_remove(&mdev_id, id);
-		return ERR_PTR(-ENOMEM);
+		return -ENOMEM;
 	}
 
 	iface->priv = inst;
@@ -1726,6 +1396,18 @@ struct kobject *most_register_interface(struct most_interface *iface)
 	inst->iface = iface;
 	inst->dev_id = id;
 	list_add_tail(&inst->list, &instance_list);
+	snprintf(name, STRING_SIZE, "mdev%d", id);
+	iface->dev.init_name = name;
+	iface->dev.bus = &most_bus;
+	iface->dev.parent = &core_dev;
+	iface->dev.groups = interface_attr_groups;
+	iface->dev.release = release_interface;
+	if (device_register(&iface->dev)) {
+		pr_err("registering iface->dev failed\n");
+		kfree(inst);
+		ida_simple_remove(&mdev_id, id);
+		return -ENOMEM;
+	}
 
 	for (i = 0; i < iface->num_channels; i++) {
 		const char *name_suffix = iface->channel_vector[i].name_suffix;
@@ -1736,9 +1418,17 @@ struct kobject *most_register_interface(struct most_interface *iface)
 			snprintf(channel_name, STRING_SIZE, "%s", name_suffix);
 
 		/* this increments the reference count of this instance */
-		c = create_most_c_obj(channel_name, &inst->kobj);
+		c = kzalloc(sizeof(*c), GFP_KERNEL);
 		if (!c)
 			goto free_instance;
+		c->dev.init_name = channel_name;
+		c->dev.parent = &iface->dev;
+		c->dev.groups = channel_attr_groups;
+		c->dev.release = release_channel;
+		if (device_register(&c->dev)) {
+			pr_err("registering c->dev failed\n");
+			goto free_instance;
+		}
 		inst->channel[i] = c;
 		c->is_starving = 0;
 		c->iface = iface;
@@ -1764,15 +1454,14 @@ struct kobject *most_register_interface(struct most_interface *iface)
 		list_add_tail(&c->list, &inst->channel_list);
 	}
 	pr_info("registered new MOST device mdev%d (%s)\n",
-		inst->dev_id, iface->description);
-	return &inst->kobj;
+		id, iface->description);
+	return 0;
 
 free_instance:
 	pr_info("Failed allocate channel(s)\n");
-	list_del(&inst->list);
+	device_unregister(&iface->dev);
 	ida_simple_remove(&mdev_id, id);
-	destroy_most_inst_obj(inst);
-	return ERR_PTR(-ENOMEM);
+	return -ENOMEM;
 }
 EXPORT_SYMBOL_GPL(most_register_interface);
 
@@ -1785,17 +1474,14 @@ EXPORT_SYMBOL_GPL(most_register_interface);
  */
 void most_deregister_interface(struct most_interface *iface)
 {
-	struct most_inst_obj *i = iface->priv;
+	int i;
 	struct most_c_obj *c;
+	struct most_inst_obj *inst;
 
-	if (unlikely(!i)) {
-		pr_info("Bad Interface\n");
-		return;
-	}
-	pr_info("deregistering MOST device %s (%s)\n", i->kobj.name,
-		iface->description);
-
-	list_for_each_entry(c, &i->channel_list, list) {
+	pr_info("deregistering MOST device %s (%s)\n", dev_name(&iface->dev), iface->description);
+	inst = iface->priv;
+	for (i = 0; i < iface->num_channels; i++) {
+		c = inst->channel[i];
 		if (c->aim0.ptr)
 			c->aim0.ptr->disconnect_channel(c->iface,
 							c->channel_id);
@@ -1804,11 +1490,14 @@ void most_deregister_interface(struct most_interface *iface)
 							c->channel_id);
 		c->aim0.ptr = NULL;
 		c->aim1.ptr = NULL;
+		list_del(&c->list);
+		device_unregister(&c->dev);
+		kfree(c);
 	}
 
-	ida_simple_remove(&mdev_id, i->dev_id);
-	list_del(&i->list);
-	destroy_most_inst_obj(i);
+	ida_simple_remove(&mdev_id, inst->dev_id);
+	kfree(inst);
+	device_unregister(&iface->dev);
 }
 EXPORT_SYMBOL_GPL(most_deregister_interface);
 
@@ -1858,13 +1547,17 @@ void most_resume_enqueue(struct most_interface *iface, int id)
 }
 EXPORT_SYMBOL_GPL(most_resume_enqueue);
 
+static void release_most_sub(struct device *dev)
+{
+	pr_info("releasing most_subsystem\n");
+}
+
 static int __init most_init(void)
 {
 	int err;
 
 	pr_info("init()\n");
 	INIT_LIST_HEAD(&instance_list);
-	INIT_LIST_HEAD(&aim_list);
 	ida_init(&mdev_id);
 
 	err = bus_register(&most_bus);
@@ -1886,30 +1579,15 @@ static int __init most_init(void)
 		goto exit_class;
 	}
 
-	core_dev = device_create(most_class, NULL, 0, NULL, "mostcore");
-	if (IS_ERR(core_dev)) {
-		err = PTR_ERR(core_dev);
-		goto exit_driver;
-	}
-
-	most_aim_kset = kset_create_and_add("aims", NULL, &core_dev->kobj);
-	if (!most_aim_kset) {
-		err = -ENOMEM;
-		goto exit_class_container;
-	}
-
-	most_inst_kset = kset_create_and_add("devices", NULL, &core_dev->kobj);
-	if (!most_inst_kset) {
+	core_dev.init_name = "most_bus";
+	core_dev.release = release_most_sub;
+	if (device_register(&core_dev)) {
 		err = -ENOMEM;
-		goto exit_driver_kset;
+		goto exit_driver;
 	}
 
 	return 0;
 
-exit_driver_kset:
-	kset_unregister(most_aim_kset);
-exit_class_container:
-	device_destroy(most_class, 0);
 exit_driver:
 	driver_unregister(&mostcore);
 exit_class:
@@ -1921,21 +1599,8 @@ static int __init most_init(void)
 
 static void __exit most_exit(void)
 {
-	struct most_inst_obj *i, *i_tmp;
-	struct most_aim_obj *d, *d_tmp;
-
 	pr_info("exit core module\n");
-	list_for_each_entry_safe(d, d_tmp, &aim_list, list) {
-		destroy_most_aim_obj(d);
-	}
-
-	list_for_each_entry_safe(i, i_tmp, &instance_list, list) {
-		list_del(&i->list);
-		destroy_most_inst_obj(i);
-	}
-	kset_unregister(most_inst_kset);
-	kset_unregister(most_aim_kset);
-	device_destroy(most_class, 0);
+	device_unregister(&core_dev);
 	driver_unregister(&mostcore);
 	class_destroy(most_class);
 	bus_unregister(&most_bus);
diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h
index a6e618c..b392ba5 100644
--- a/drivers/staging/most/core.h
+++ b/drivers/staging/most/core.h
@@ -23,8 +23,8 @@
 #define __MOST_CORE_H__
 
 #include <linux/types.h>
+#include <linux/device.h>
 
-struct kobject;
 struct module;
 
 /**
@@ -238,6 +238,7 @@ struct mbo {
  * @priv Private field used by mostcore to store context information.
  */
 struct most_interface {
+	struct device dev;
 	struct module *mod;
 	enum most_interface_type interface;
 	const char *description;
@@ -255,6 +256,8 @@ struct most_interface {
 	void *priv;
 };
 
+#define to_most_interface(d) container_of(d, struct most_interface, dev)
+
 /**
  * struct most_aim - identifies MOST device driver to mostcore
  * @name: Driver name
@@ -265,10 +268,10 @@ struct most_interface {
  * @context: context pointer to be used by mostcore
  */
 struct most_aim {
+	struct device dev;
 	const char *name;
 	int (*probe_channel)(struct most_interface *iface, int channel_idx,
-			     struct most_channel_config *cfg,
-			     struct kobject *parent, char *name);
+			     struct most_channel_config *cfg, char *name);
 	int (*disconnect_channel)(struct most_interface *iface,
 				  int channel_idx);
 	int (*rx_completion)(struct mbo *mbo);
@@ -276,6 +279,8 @@ struct most_aim {
 	void *context;
 };
 
+#define to_most_aim(d) container_of(d, struct most_aim, dev)
+
 /**
  * most_register_interface - Registers instance of the interface.
  * @iface: Pointer to the interface instance description.
@@ -285,7 +290,7 @@ struct most_aim {
  * Note: HDM has to ensure that any reference held on the kobj is
  * released before deregistering the interface.
  */
-struct kobject *most_register_interface(struct most_interface *iface);
+int most_register_interface(struct most_interface *iface);
 
 /**
  * Deregisters instance of the interface.
diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index 0a1b785..d2d914d 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -93,6 +93,7 @@ struct hdm_channel {
  * @atx_idx: index of async tx channel
  */
 struct dim2_hdm {
+	struct device dev;
 	struct hdm_channel hch[DMA_CHANNELS];
 	struct most_channel_capability capabilities[DMA_CHANNELS];
 	struct most_interface most_iface;
@@ -744,7 +745,6 @@ static int dim2_probe(struct platform_device *pdev)
 	struct dim2_hdm *dev;
 	struct resource *res;
 	int ret, i;
-	struct kobject *kobj;
 	int irq;
 
 	dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
@@ -832,17 +832,20 @@ static int dim2_probe(struct platform_device *pdev)
 	dev->most_iface.enqueue = enqueue;
 	dev->most_iface.poison_channel = poison_channel;
 	dev->most_iface.request_netinfo = request_netinfo;
+	dev->dev.init_name = "dim2_state";
+	dev->dev.parent = &dev->most_iface.dev;
 
-	kobj = most_register_interface(&dev->most_iface);
-	if (IS_ERR(kobj)) {
-		ret = PTR_ERR(kobj);
+	ret = most_register_interface(&dev->most_iface);
+	if (ret) {
 		dev_err(&pdev->dev, "failed to register MOST interface\n");
 		goto err_stop_thread;
 	}
 
-	ret = dim2_sysfs_probe(&dev->bus, kobj);
-	if (ret)
+	ret = dim2_sysfs_probe(&dev->dev);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to create sysfs attribute\n");
 		goto err_unreg_iface;
+	}
 
 	ret = startup_dim(pdev);
 	if (ret) {
@@ -853,7 +856,7 @@ static int dim2_probe(struct platform_device *pdev)
 	return 0;
 
 err_destroy_bus:
-	dim2_sysfs_destroy(&dev->bus);
+	dim2_sysfs_destroy(&dev->dev);
 err_unreg_iface:
 	most_deregister_interface(&dev->most_iface);
 err_stop_thread:
@@ -881,7 +884,7 @@ static int dim2_remove(struct platform_device *pdev)
 	if (pdata && pdata->destroy)
 		pdata->destroy(pdata);
 
-	dim2_sysfs_destroy(&dev->bus);
+	dim2_sysfs_destroy(&dev->dev);
 	most_deregister_interface(&dev->most_iface);
 	kthread_stop(dev->netinfo_task);
 
diff --git a/drivers/staging/most/dim2/sysfs.c b/drivers/staging/most/dim2/sysfs.c
index 1331cf0..5ab0c02 100644
--- a/drivers/staging/most/dim2/sysfs.c
+++ b/drivers/staging/most/dim2/sysfs.c
@@ -17,99 +17,39 @@
 
 #include <linux/kernel.h>
 #include "sysfs.h"
+#include <linux/device.h>
 
-struct bus_attr {
-	struct attribute attr;
-	ssize_t (*show)(struct medialb_bus *bus, char *buf);
-	ssize_t (*store)(struct medialb_bus *bus, const char *buf,
-			 size_t count);
-};
-
-static ssize_t state_show(struct medialb_bus *bus, char *buf)
+static ssize_t state_show(struct device *dev, struct device_attribute *attr,
+			  char *buf)
 {
 	bool state = dim2_sysfs_get_state_cb();
 
 	return sprintf(buf, "%s\n", state ? "locked" : "");
 }
 
-static struct bus_attr state_attr = __ATTR_RO(state);
+DEVICE_ATTR_RO(state);
 
-static struct attribute *bus_default_attrs[] = {
-	&state_attr.attr,
+static struct attribute *dev_attrs[] = {
+	&dev_attr_state.attr,
 	NULL,
 };
 
-static const struct attribute_group bus_attr_group = {
-	.attrs = bus_default_attrs,
+static struct attribute_group dev_attr_group = {
+	.attrs = dev_attrs,
 };
 
-static void bus_kobj_release(struct kobject *kobj)
-{
-}
-
-static ssize_t bus_kobj_attr_show(struct kobject *kobj, struct attribute *attr,
-				  char *buf)
-{
-	struct medialb_bus *bus =
-		container_of(kobj, struct medialb_bus, kobj_group);
-	struct bus_attr *xattr = container_of(attr, struct bus_attr, attr);
-
-	if (!xattr->show)
-		return -EIO;
-
-	return xattr->show(bus, buf);
-}
-
-static ssize_t bus_kobj_attr_store(struct kobject *kobj, struct attribute *attr,
-				   const char *buf, size_t count)
-{
-	struct medialb_bus *bus =
-		container_of(kobj, struct medialb_bus, kobj_group);
-	struct bus_attr *xattr = container_of(attr, struct bus_attr, attr);
-
-	if (!xattr->store)
-		return -EIO;
-
-	return xattr->store(bus, buf, count);
-}
-
-static struct sysfs_ops const bus_kobj_sysfs_ops = {
-	.show = bus_kobj_attr_show,
-	.store = bus_kobj_attr_store,
-};
-
-static struct kobj_type bus_ktype = {
-	.release = bus_kobj_release,
-	.sysfs_ops = &bus_kobj_sysfs_ops,
+static const struct attribute_group *dev_attr_groups[] = {
+	&dev_attr_group,
+	NULL,
 };
 
-int dim2_sysfs_probe(struct medialb_bus *bus, struct kobject *parent_kobj)
+int dim2_sysfs_probe(struct device *dev)
 {
-	int err;
-
-	kobject_init(&bus->kobj_group, &bus_ktype);
-	err = kobject_add(&bus->kobj_group, parent_kobj, "bus");
-	if (err) {
-		pr_err("kobject_add() failed: %d\n", err);
-		goto err_kobject_add;
-	}
-
-	err = sysfs_create_group(&bus->kobj_group, &bus_attr_group);
-	if (err) {
-		pr_err("sysfs_create_group() failed: %d\n", err);
-		goto err_create_group;
-	}
-
-	return 0;
-
-err_create_group:
-	kobject_put(&bus->kobj_group);
-
-err_kobject_add:
-	return err;
+	dev->groups = dev_attr_groups;
+	return device_register(dev);
 }
 
-void dim2_sysfs_destroy(struct medialb_bus *bus)
+void dim2_sysfs_destroy(struct device *dev)
 {
-	kobject_put(&bus->kobj_group);
+	device_unregister(dev);
 }
diff --git a/drivers/staging/most/dim2/sysfs.h b/drivers/staging/most/dim2/sysfs.h
index 236de47..070a70c 100644
--- a/drivers/staging/most/dim2/sysfs.h
+++ b/drivers/staging/most/dim2/sysfs.h
@@ -22,10 +22,10 @@ struct medialb_bus {
 	struct kobject kobj_group;
 };
 
-struct dim2_hdm;
+struct device;
 
-int dim2_sysfs_probe(struct medialb_bus *bus, struct kobject *parent_kobj);
-void dim2_sysfs_destroy(struct medialb_bus *bus);
+int dim2_sysfs_probe(struct device *dev);
+void dim2_sysfs_destroy(struct device *dev);
 
 /*
  * callback,
diff --git a/drivers/staging/most/i2c/i2c.c b/drivers/staging/most/i2c/i2c.c
index 6081943..9165c72 100644
--- a/drivers/staging/most/i2c/i2c.c
+++ b/drivers/staging/most/i2c/i2c.c
@@ -309,7 +309,6 @@ static int i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
 {
 	struct hdm_i2c *dev;
 	int ret, i;
-	struct kobject *kobj;
 
 	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
 	if (!dev)
@@ -347,11 +346,11 @@ static int i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	dev->client = client;
 	i2c_set_clientdata(client, dev);
 
-	kobj = most_register_interface(&dev->most_iface);
-	if (IS_ERR(kobj)) {
+	ret = most_register_interface(&dev->most_iface);
+	if (ret) {
 		pr_err("Failed to register i2c as a MOST interface\n");
 		kfree(dev);
-		return PTR_ERR(kobj);
+		return ret;
 	}
 
 	dev->polling_mode = polling_req || client->irq <= 0;
diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c
index 9b4a804..06501ff 100644
--- a/drivers/staging/most/net/net.c
+++ b/drivers/staging/most/net/net.c
@@ -297,8 +297,7 @@ static struct net_dev_context *get_net_dev_hold(struct most_interface *iface)
 }
 
 static int aim_probe_channel(struct most_interface *iface, int channel_idx,
-			     struct most_channel_config *ccfg,
-			     struct kobject *parent, char *name)
+			     struct most_channel_config *ccfg, char *name)
 {
 	struct net_dev_context *nd;
 	struct net_dev_channel *ch;
diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c
index 72603ae..d8ce059 100644
--- a/drivers/staging/most/sound/sound.c
+++ b/drivers/staging/most/sound/sound.c
@@ -545,7 +545,6 @@ static int audio_set_hw_params(struct snd_pcm_hardware *pcm_hw,
  * @iface: pointer to interface instance
  * @channel_id: channel index/ID
  * @cfg: pointer to actual channel configuration
- * @parent: pointer to kobject (needed for sysfs hook-up)
  * @arg_list: string that provides the name of the device to be created in /dev
  *	      plus the desired audio resolution
  *
@@ -555,7 +554,7 @@ static int audio_set_hw_params(struct snd_pcm_hardware *pcm_hw,
  */
 static int audio_probe_channel(struct most_interface *iface, int channel_id,
 			       struct most_channel_config *cfg,
-			       struct kobject *parent, char *arg_list)
+			       char *arg_list)
 {
 	struct channel *channel;
 	struct snd_card *card;
diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index 492480d..da2fc54 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -70,12 +70,12 @@
  * @reg_addr: register address for arbitrary DCI access
  */
 struct most_dci_obj {
-	struct kobject kobj;
+	struct device dev;
 	struct usb_device *usb_device;
 	u16 reg_addr;
 };
 
-#define to_dci_obj(p) container_of(p, struct most_dci_obj, kobj)
+#define to_dci_obj(p) container_of(p, struct most_dci_obj, dev)
 
 struct most_dev;
 
@@ -90,7 +90,6 @@ struct clear_hold_work {
 
 /**
  * struct most_dev - holds all usb interface specific stuff
- * @parent: parent object in sysfs
  * @usb_device: pointer to usb device
  * @iface: hardware interface
  * @cap: channel capabilities
@@ -108,7 +107,6 @@ struct clear_hold_work {
  * @poll_work_obj: work for polling link status
  */
 struct most_dev {
-	struct kobject *parent;
 	struct usb_device *usb_device;
 	struct most_interface iface;
 	struct most_channel_capability *cap;
@@ -840,94 +838,6 @@ static const struct usb_device_id usbid[] = {
 	{ } /* Terminating entry */
 };
 
-#define MOST_DCI_RO_ATTR(_name) \
-	struct most_dci_attribute most_dci_attr_##_name = \
-		__ATTR(_name, 0444, show_value, NULL)
-
-#define MOST_DCI_ATTR(_name) \
-	struct most_dci_attribute most_dci_attr_##_name = \
-		__ATTR(_name, 0644, show_value, store_value)
-
-#define MOST_DCI_WO_ATTR(_name) \
-	struct most_dci_attribute most_dci_attr_##_name = \
-		__ATTR(_name, 0200, NULL, store_value)
-
-/**
- * struct most_dci_attribute - to access the attributes of a dci object
- * @attr: attributes of a dci object
- * @show: pointer to the show function
- * @store: pointer to the store function
- */
-struct most_dci_attribute {
-	struct attribute attr;
-	ssize_t (*show)(struct most_dci_obj *d,
-			struct most_dci_attribute *attr,
-			char *buf);
-	ssize_t (*store)(struct most_dci_obj *d,
-			 struct most_dci_attribute *attr,
-			 const char *buf,
-			 size_t count);
-};
-
-#define to_dci_attr(a) container_of(a, struct most_dci_attribute, attr)
-
-/**
- * dci_attr_show - show function for dci object
- * @kobj: pointer to kobject
- * @attr: pointer to attribute struct
- * @buf: buffer
- */
-static ssize_t dci_attr_show(struct kobject *kobj, struct attribute *attr,
-			     char *buf)
-{
-	struct most_dci_attribute *dci_attr = to_dci_attr(attr);
-	struct most_dci_obj *dci_obj = to_dci_obj(kobj);
-
-	if (!dci_attr->show)
-		return -EIO;
-
-	return dci_attr->show(dci_obj, dci_attr, buf);
-}
-
-/**
- * dci_attr_store - store function for dci object
- * @kobj: pointer to kobject
- * @attr: pointer to attribute struct
- * @buf: buffer
- * @len: length of buffer
- */
-static ssize_t dci_attr_store(struct kobject *kobj,
-			      struct attribute *attr,
-			      const char *buf,
-			      size_t len)
-{
-	struct most_dci_attribute *dci_attr = to_dci_attr(attr);
-	struct most_dci_obj *dci_obj = to_dci_obj(kobj);
-
-	if (!dci_attr->store)
-		return -EIO;
-
-	return dci_attr->store(dci_obj, dci_attr, buf, len);
-}
-
-static const struct sysfs_ops most_dci_sysfs_ops = {
-	.show = dci_attr_show,
-	.store = dci_attr_store,
-};
-
-/**
- * most_dci_release - release function for dci object
- * @kobj: pointer to kobject
- *
- * This frees the memory allocated for the dci object
- */
-static void most_dci_release(struct kobject *kobj)
-{
-	struct most_dci_obj *dci_obj = to_dci_obj(kobj);
-
-	kfree(dci_obj);
-}
-
 struct regs {
 	const char *name;
 	u16 reg;
@@ -968,10 +878,11 @@ static int get_stat_reg_addr(const struct regs *regs, int size,
 #define get_static_reg_addr(regs, name, reg_addr) \
 	get_stat_reg_addr(regs, ARRAY_SIZE(regs), name, reg_addr)
 
-static ssize_t show_value(struct most_dci_obj *dci_obj,
-			  struct most_dci_attribute *attr, char *buf)
+static ssize_t show_value(struct device *dev, struct device_attribute *attr,
+			  char *buf)
 {
 	const char *name = attr->attr.name;
+	struct most_dci_obj *dci_obj = to_dci_obj(dev);
 	u16 val;
 	u16 reg_addr;
 	int err;
@@ -992,13 +903,13 @@ static ssize_t show_value(struct most_dci_obj *dci_obj,
 	return snprintf(buf, PAGE_SIZE, "%04x\n", val);
 }
 
-static ssize_t store_value(struct most_dci_obj *dci_obj,
-			   struct most_dci_attribute *attr,
+static ssize_t store_value(struct device *dev, struct device_attribute *attr,
 			   const char *buf, size_t count)
 {
 	u16 val;
 	u16 reg_addr;
 	const char *name = attr->attr.name;
+	struct most_dci_obj *dci_obj = to_dci_obj(dev);
 	struct usb_device *usb_dev = dci_obj->usb_device;
 	int err = kstrtou16(buf, 16, &val);
 
@@ -1025,86 +936,49 @@ static ssize_t store_value(struct most_dci_obj *dci_obj,
 	return count;
 }
 
-static MOST_DCI_RO_ATTR(ni_state);
-static MOST_DCI_RO_ATTR(packet_bandwidth);
-static MOST_DCI_RO_ATTR(node_address);
-static MOST_DCI_RO_ATTR(node_position);
-static MOST_DCI_WO_ATTR(sync_ep);
-static MOST_DCI_ATTR(mep_filter);
-static MOST_DCI_ATTR(mep_hash0);
-static MOST_DCI_ATTR(mep_hash1);
-static MOST_DCI_ATTR(mep_hash2);
-static MOST_DCI_ATTR(mep_hash3);
-static MOST_DCI_ATTR(mep_eui48_hi);
-static MOST_DCI_ATTR(mep_eui48_mi);
-static MOST_DCI_ATTR(mep_eui48_lo);
-static MOST_DCI_ATTR(arb_address);
-static MOST_DCI_ATTR(arb_value);
-
-/**
- * most_dci_def_attrs - array of default attribute files of the dci object
- */
-static struct attribute *most_dci_def_attrs[] = {
-	&most_dci_attr_ni_state.attr,
-	&most_dci_attr_packet_bandwidth.attr,
-	&most_dci_attr_node_address.attr,
-	&most_dci_attr_node_position.attr,
-	&most_dci_attr_sync_ep.attr,
-	&most_dci_attr_mep_filter.attr,
-	&most_dci_attr_mep_hash0.attr,
-	&most_dci_attr_mep_hash1.attr,
-	&most_dci_attr_mep_hash2.attr,
-	&most_dci_attr_mep_hash3.attr,
-	&most_dci_attr_mep_eui48_hi.attr,
-	&most_dci_attr_mep_eui48_mi.attr,
-	&most_dci_attr_mep_eui48_lo.attr,
-	&most_dci_attr_arb_address.attr,
-	&most_dci_attr_arb_value.attr,
+DEVICE_ATTR(ni_state, 0444, show_value, NULL);
+DEVICE_ATTR(packet_bandwidth, 0444, show_value, NULL);
+DEVICE_ATTR(node_address, 0444, show_value, NULL);
+DEVICE_ATTR(node_position, 0444, show_value, NULL);
+DEVICE_ATTR(sync_ep, 0200, NULL, store_value);
+DEVICE_ATTR(mep_filter, 0644, show_value, store_value);
+DEVICE_ATTR(mep_hash0, 0644, show_value, store_value);
+DEVICE_ATTR(mep_hash1, 0644, show_value, store_value);
+DEVICE_ATTR(mep_hash2, 0644, show_value, store_value);
+DEVICE_ATTR(mep_hash3, 0644, show_value, store_value);
+DEVICE_ATTR(mep_eui48_hi, 0644, show_value, store_value);
+DEVICE_ATTR(mep_eui48_mi, 0644, show_value, store_value);
+DEVICE_ATTR(mep_eui48_lo, 0644, show_value, store_value);
+DEVICE_ATTR(arb_address, 0644, show_value, store_value);
+DEVICE_ATTR(arb_value, 0644, show_value, store_value);
+
+static struct attribute *dci_attrs[] = {
+	&dev_attr_ni_state.attr,
+	&dev_attr_packet_bandwidth.attr,
+	&dev_attr_node_address.attr,
+	&dev_attr_node_position.attr,
+	&dev_attr_sync_ep.attr,
+	&dev_attr_mep_filter.attr,
+	&dev_attr_mep_hash0.attr,
+	&dev_attr_mep_hash1.attr,
+	&dev_attr_mep_hash2.attr,
+	&dev_attr_mep_hash3.attr,
+	&dev_attr_mep_eui48_hi.attr,
+	&dev_attr_mep_eui48_mi.attr,
+	&dev_attr_mep_eui48_lo.attr,
+	&dev_attr_arb_address.attr,
+	&dev_attr_arb_value.attr,
 	NULL,
 };
 
-/**
- * DCI ktype
- */
-static struct kobj_type most_dci_ktype = {
-	.sysfs_ops = &most_dci_sysfs_ops,
-	.release = most_dci_release,
-	.default_attrs = most_dci_def_attrs,
+static struct attribute_group dci_attr_group = {
+	.attrs = dci_attrs,
 };
 
-/**
- * create_most_dci_obj - allocates a dci object
- * @parent: parent kobject
- *
- * This creates a dci object and registers it with sysfs.
- * Returns a pointer to the object or NULL when something went wrong.
- */
-static struct
-most_dci_obj *create_most_dci_obj(struct kobject *parent)
-{
-	struct most_dci_obj *most_dci = kzalloc(sizeof(*most_dci), GFP_KERNEL);
-	int retval;
-
-	if (!most_dci)
-		return NULL;
-
-	retval = kobject_init_and_add(&most_dci->kobj, &most_dci_ktype, parent,
-				      "dci");
-	if (retval) {
-		kobject_put(&most_dci->kobj);
-		return NULL;
-	}
-	return most_dci;
-}
-
-/**
- * destroy_most_dci_obj - DCI object release function
- * @p: pointer to dci object
- */
-static void destroy_most_dci_obj(struct most_dci_obj *p)
-{
-	kobject_put(&p->kobj);
-}
+static const struct attribute_group *dci_attr_groups[] = {
+	&dci_attr_group,
+	NULL,
+};
 
 /**
  * hdm_probe - probe function of USB device driver
@@ -1218,20 +1092,15 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
 		   usb_dev->config->desc.bConfigurationValue,
 		   usb_iface_desc->desc.bInterfaceNumber);
 
-	mdev->parent = most_register_interface(&mdev->iface);
-	if (IS_ERR(mdev->parent)) {
-		ret = PTR_ERR(mdev->parent);
+	ret = most_register_interface(&mdev->iface);
+	if (ret)
 		goto exit_free4;
-	}
 
 	mutex_lock(&mdev->io_mutex);
 	if (le16_to_cpu(usb_dev->descriptor.idProduct) == USB_DEV_ID_OS81118 ||
 	    le16_to_cpu(usb_dev->descriptor.idProduct) == USB_DEV_ID_OS81119 ||
 	    le16_to_cpu(usb_dev->descriptor.idProduct) == USB_DEV_ID_OS81210) {
-		/* this increments the reference count of the instance
-		 * object of the core
-		 */
-		mdev->dci = create_most_dci_obj(mdev->parent);
+		mdev->dci = kzalloc(sizeof(*mdev->dci), GFP_KERNEL);
 		if (!mdev->dci) {
 			mutex_unlock(&mdev->io_mutex);
 			most_deregister_interface(&mdev->iface);
@@ -1239,12 +1108,21 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
 			goto exit_free4;
 		}
 
-		kobject_uevent(&mdev->dci->kobj, KOBJ_ADD);
+		mdev->dci->dev.init_name = "dci";
+		mdev->dci->dev.parent = &mdev->iface.dev;
+		mdev->dci->dev.groups = dci_attr_groups;
+		if (device_register(&mdev->dci->dev)) {
+			mutex_unlock(&mdev->io_mutex);
+			most_deregister_interface(&mdev->iface);
+			ret = -ENOMEM;
+			goto exit_free5;
+		}
 		mdev->dci->usb_device = mdev->usb_device;
 	}
 	mutex_unlock(&mdev->io_mutex);
 	return 0;
-
+exit_free5:
+	kfree(mdev->dci);
 exit_free4:
 	kfree(mdev->busy_urbs);
 exit_free3:
@@ -1284,7 +1162,8 @@ static void hdm_disconnect(struct usb_interface *interface)
 	del_timer_sync(&mdev->link_stat_timer);
 	cancel_work_sync(&mdev->poll_work_obj);
 
-	destroy_most_dci_obj(mdev->dci);
+	device_unregister(&mdev->dci->dev);
+	kfree(mdev->dci);
 	most_deregister_interface(&mdev->iface);
 
 	kfree(mdev->busy_urbs);
diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
index b418c09..2c27416 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -486,8 +486,7 @@ static void aim_v4l2_dev_release(struct v4l2_device *v4l2_dev)
 }
 
 static int aim_probe_channel(struct most_interface *iface, int channel_idx,
-			     struct most_channel_config *ccfg,
-			     struct kobject *parent, char *name)
+			     struct most_channel_config *ccfg, char *name)
 {
 	int ret;
 	struct most_video_dev *mdev = get_aim_dev(iface, channel_idx);
-- 
2.7.4

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

* [PATCH 10/50] staging: most: core: remove function get_channel_by_iface
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (8 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 09/50] staging: most: remove proprietary kobjects Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-22 10:44   ` Frans Klaver
  2017-11-21 14:04 ` [PATCH 11/50] staging: most: core: add a match function for the bus Christian Gromm
                   ` (41 subsequent siblings)
  51 siblings, 1 reply; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch removes the function get_channel_by_iface that walks a list of
all registered interfaces and returns a pointer to a channel when matched.
Instead the private field of the interface structure is used to directly
access the channel via the id. The patch is needed to remove unnecessary
list traversing.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 47 +++++++++++++--------------------------------
 1 file changed, 13 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 8c9b10d..d8e3b88 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -995,37 +995,10 @@ static void most_write_completion(struct mbo *mbo)
 		arm_mbo(mbo);
 }
 
-/**
- * get_channel_by_iface - get pointer to channel object
- * @iface: pointer to interface instance
- * @id: channel ID
- *
- * This retrieves a pointer to a channel of the given interface and channel ID.
- */
-static struct
-most_c_obj *get_channel_by_iface(struct most_interface *iface, int id)
-{
-	struct most_inst_obj *i;
-
-	if (unlikely(!iface)) {
-		pr_err("Bad interface\n");
-		return NULL;
-	}
-	if (unlikely((id < 0) || (id >= iface->num_channels))) {
-		pr_err("Channel index (%d) out of range\n", id);
-		return NULL;
-	}
-	i = iface->priv;
-	if (unlikely(!i)) {
-		pr_err("interface is not registered\n");
-		return NULL;
-	}
-	return i->channel[id];
-}
-
 int channel_has_mbo(struct most_interface *iface, int id, struct most_aim *aim)
 {
-	struct most_c_obj *c = get_channel_by_iface(iface, id);
+	struct most_inst_obj *inst = iface->priv;
+	struct most_c_obj *c = inst->channel[id];
 	unsigned long flags;
 	int empty;
 
@@ -1057,10 +1030,11 @@ struct mbo *most_get_mbo(struct most_interface *iface, int id,
 {
 	struct mbo *mbo;
 	struct most_c_obj *c;
+	struct most_inst_obj *inst = iface->priv;
 	unsigned long flags;
 	int *num_buffers_ptr;
 
-	c = get_channel_by_iface(iface, id);
+	c = inst->channel[id];
 	if (unlikely(!c))
 		return NULL;
 
@@ -1162,7 +1136,8 @@ int most_start_channel(struct most_interface *iface, int id,
 {
 	int num_buffer;
 	int ret;
-	struct most_c_obj *c = get_channel_by_iface(iface, id);
+	struct most_inst_obj *inst = iface->priv;
+	struct most_c_obj *c = inst->channel[id];
 
 	if (unlikely(!c))
 		return -EINVAL;
@@ -1230,13 +1205,15 @@ EXPORT_SYMBOL_GPL(most_start_channel);
 int most_stop_channel(struct most_interface *iface, int id,
 		      struct most_aim *aim)
 {
+	struct most_inst_obj *inst;
 	struct most_c_obj *c;
 
 	if (unlikely((!iface) || (id >= iface->num_channels) || (id < 0))) {
 		pr_err("Bad interface or index out of range\n");
 		return -EINVAL;
 	}
-	c = get_channel_by_iface(iface, id);
+	inst = iface->priv;
+	c = inst->channel[id];
 	if (unlikely(!c))
 		return -EINVAL;
 
@@ -1513,7 +1490,8 @@ EXPORT_SYMBOL_GPL(most_deregister_interface);
  */
 void most_stop_enqueue(struct most_interface *iface, int id)
 {
-	struct most_c_obj *c = get_channel_by_iface(iface, id);
+	struct most_inst_obj *inst = iface->priv;
+	struct most_c_obj *c = inst->channel[id];
 
 	if (!c)
 		return;
@@ -1534,7 +1512,8 @@ EXPORT_SYMBOL_GPL(most_stop_enqueue);
  */
 void most_resume_enqueue(struct most_interface *iface, int id)
 {
-	struct most_c_obj *c = get_channel_by_iface(iface, id);
+	struct most_inst_obj *inst = iface->priv;
+	struct most_c_obj *c = inst->channel[id];
 
 	if (!c)
 		return;
-- 
2.7.4

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

* [PATCH 11/50] staging: most: core: add a match function for the bus
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (9 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 10/50] staging: most: core: remove function get_channel_by_iface Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 12/50] staging: most: core: encapsulate code in function Christian Gromm
                   ` (40 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch adds the function most_match. It is needed to accociate
registered devices and drivers with the bus.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index d8e3b88..dbd7258 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -762,11 +762,20 @@ static const struct attribute_group *aim_attr_groups[] = {
  *		     ___C O R E___
  */
 
+int most_match(struct device *dev, struct device_driver *drv)
+{
+	if (!strcmp(dev_name(dev), "most"))
+		return 0;
+	else
+		return 1;
+}
+
 /**
  * Instantiation of the MOST bus
  */
 static struct bus_type most_bus = {
 	.name = "most",
+	.match = most_match,
 };
 
 /**
-- 
2.7.4

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

* [PATCH 12/50] staging: most: core: encapsulate code in function
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (10 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 11/50] staging: most: core: add a match function for the bus Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 13/50] staging: most: core: rename structure Christian Gromm
                   ` (39 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch adds the function link_channel_to_aim to increase readability
of the function add_link_store.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 39 ++++++++++++++++++++++++++-------------
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index dbd7258..662fe1c 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -626,6 +626,30 @@ most_c_obj *get_channel_by_name(char *mdev, char *mdev_ch)
 	return c;
 }
 
+static inline int link_channel_to_aim(struct most_c_obj *c,
+				      struct most_aim *aim, char *aim_param)
+{
+	int ret;
+	struct most_aim **aim_ptr;
+
+	if (!c->aim0.ptr)
+		aim_ptr = &c->aim0.ptr;
+	else if (!c->aim1.ptr)
+		aim_ptr = &c->aim1.ptr;
+	else
+		return -ENOSPC;
+
+	*aim_ptr = aim;
+	ret = aim->probe_channel(c->iface, c->channel_id,
+				 &c->cfg, aim_param);
+	if (ret) {
+		*aim_ptr = NULL;
+		return ret;
+	}
+
+	return 0;
+}
+
 /**
  * add_link_store - store() function for add_link attribute
  * @aim_obj: pointer to AIM object
@@ -654,7 +678,6 @@ static ssize_t add_link_store(struct device *dev,
 			      size_t len)
 {
 	struct most_c_obj *c;
-	struct most_aim **aim_ptr;
 	struct most_aim *aim = to_most_aim(dev);
 	char buffer[STRING_SIZE];
 	char *mdev;
@@ -680,19 +703,9 @@ static ssize_t add_link_store(struct device *dev,
 	if (IS_ERR(c))
 		return -ENODEV;
 
-	if (!c->aim0.ptr)
-		aim_ptr = &c->aim0.ptr;
-	else if (!c->aim1.ptr)
-		aim_ptr = &c->aim1.ptr;
-	else
-		return -ENOSPC;
-
-	*aim_ptr = aim;
-	ret = aim->probe_channel(c->iface, c->channel_id, &c->cfg, mdev_devnod);
-	if (ret) {
-		*aim_ptr = NULL;
+	ret = link_channel_to_aim(c, aim, mdev_devnod);
+	if (ret)
 		return ret;
-	}
 
 	return len;
 }
-- 
2.7.4

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

* [PATCH 13/50] staging: most: core: rename structure
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (11 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 12/50] staging: most: core: encapsulate code in function Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 14/50] staging: most: core: rename struct most_c_aim_obj to pipe Christian Gromm
                   ` (38 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the structure most_c_obj to most_channel. This is needed
to enhance readability.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 104 ++++++++++++++++++++++----------------------
 1 file changed, 52 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 662fe1c..f7aa5ad 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -43,7 +43,7 @@ struct most_c_aim_obj {
 	int num_buffers;
 };
 
-struct most_c_obj {
+struct most_channel {
 	struct device dev;
 	struct completion cleanup;
 	atomic_t mbo_ref;
@@ -69,13 +69,13 @@ struct most_c_obj {
 	wait_queue_head_t hdm_fifo_wq;
 };
 
-#define to_c_obj(d) container_of(d, struct most_c_obj, dev)
+#define to_channel(d) container_of(d, struct most_channel, dev)
 
 struct most_inst_obj {
 	int dev_id;
 	struct most_interface *iface;
 	struct list_head channel_list;
-	struct most_c_obj *channel[MAX_CHANNELS];
+	struct most_channel *channel[MAX_CHANNELS];
 	struct list_head list;
 };
 
@@ -112,7 +112,7 @@ static const struct {
  */
 static void most_free_mbo_coherent(struct mbo *mbo)
 {
-	struct most_c_obj *c = mbo->context;
+	struct most_channel *c = mbo->context;
 	u16 const coherent_buf_size = c->cfg.buffer_size + c->cfg.extra_len;
 
 	dma_free_coherent(NULL, coherent_buf_size, mbo->virt_address,
@@ -126,7 +126,7 @@ static void most_free_mbo_coherent(struct mbo *mbo)
  * flush_channel_fifos - clear the channel fifos
  * @c: pointer to channel object
  */
-static void flush_channel_fifos(struct most_c_obj *c)
+static void flush_channel_fifos(struct most_channel *c)
 {
 	unsigned long flags, hf_flags;
 	struct mbo *mbo, *tmp;
@@ -160,7 +160,7 @@ static void flush_channel_fifos(struct most_c_obj *c)
  * flush_trash_fifo - clear the trash fifo
  * @c: pointer to channel object
  */
-static int flush_trash_fifo(struct most_c_obj *c)
+static int flush_trash_fifo(struct most_channel *c)
 {
 	struct mbo *mbo, *tmp;
 	unsigned long flags;
@@ -180,7 +180,7 @@ static ssize_t available_directions_show(struct device *dev,
 					 struct device_attribute *attr,
 					 char *buf)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 	unsigned int i = c->channel_id;
 
 	strcpy(buf, "");
@@ -196,7 +196,7 @@ static ssize_t available_datatypes_show(struct device *dev,
 					struct device_attribute *attr,
 					char *buf)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 	unsigned int i = c->channel_id;
 
 	strcpy(buf, "");
@@ -216,7 +216,7 @@ static ssize_t number_of_packet_buffers_show(struct device *dev,
 					     struct device_attribute *attr,
 					     char *buf)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 	unsigned int i = c->channel_id;
 
 	return snprintf(buf, PAGE_SIZE, "%d\n",
@@ -227,7 +227,7 @@ static ssize_t number_of_stream_buffers_show(struct device *dev,
 					     struct device_attribute *attr,
 					     char *buf)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 	unsigned int i = c->channel_id;
 
 	return snprintf(buf, PAGE_SIZE, "%d\n",
@@ -238,7 +238,7 @@ static ssize_t size_of_packet_buffer_show(struct device *dev,
 					  struct device_attribute *attr,
 					  char *buf)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 	unsigned int i = c->channel_id;
 
 	return snprintf(buf, PAGE_SIZE, "%d\n",
@@ -249,7 +249,7 @@ static ssize_t size_of_stream_buffer_show(struct device *dev,
 					  struct device_attribute *attr,
 					  char *buf)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 	unsigned int i = c->channel_id;
 
 	return snprintf(buf, PAGE_SIZE, "%d\n",
@@ -260,7 +260,7 @@ static ssize_t channel_starving_show(struct device *dev,
 				     struct device_attribute *attr,
 				     char *buf)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 
 	return snprintf(buf, PAGE_SIZE, "%d\n", c->is_starving);
 }
@@ -269,7 +269,7 @@ static ssize_t set_number_of_buffers_show(struct device *dev,
 					  struct device_attribute *attr,
 					  char *buf)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 
 	return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.num_buffers);
 }
@@ -279,7 +279,7 @@ static ssize_t set_number_of_buffers_store(struct device *dev,
 					   const char *buf,
 					   size_t count)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 
 	int ret = kstrtou16(buf, 0, &c->cfg.num_buffers);
 
@@ -292,7 +292,7 @@ static ssize_t set_buffer_size_show(struct device *dev,
 				    struct device_attribute *attr,
 				    char *buf)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 
 	return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.buffer_size);
 }
@@ -302,7 +302,7 @@ static ssize_t set_buffer_size_store(struct device *dev,
 				     const char *buf,
 				     size_t count)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 	int ret = kstrtou16(buf, 0, &c->cfg.buffer_size);
 
 	if (ret)
@@ -314,7 +314,7 @@ static ssize_t set_direction_show(struct device *dev,
 				  struct device_attribute *attr,
 				  char *buf)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 
 	if (c->cfg.direction & MOST_CH_TX)
 		return snprintf(buf, PAGE_SIZE, "tx\n");
@@ -328,7 +328,7 @@ static ssize_t set_direction_store(struct device *dev,
 				   const char *buf,
 				   size_t count)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 
 	if (!strcmp(buf, "dir_rx\n")) {
 		c->cfg.direction = MOST_CH_RX;
@@ -350,7 +350,7 @@ static ssize_t set_datatype_show(struct device *dev,
 				 char *buf)
 {
 	int i;
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 
 	for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
 		if (c->cfg.data_type & ch_data_type[i].most_ch_data_type)
@@ -365,7 +365,7 @@ static ssize_t set_datatype_store(struct device *dev,
 				  size_t count)
 {
 	int i;
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 
 	for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
 		if (!strcmp(buf, ch_data_type[i].name)) {
@@ -385,7 +385,7 @@ static ssize_t set_subbuffer_size_show(struct device *dev,
 				       struct device_attribute *attr,
 				       char *buf)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 
 	return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.subbuffer_size);
 }
@@ -395,7 +395,7 @@ static ssize_t set_subbuffer_size_store(struct device *dev,
 					const char *buf,
 					size_t count)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 	int ret = kstrtou16(buf, 0, &c->cfg.subbuffer_size);
 
 	if (ret)
@@ -407,7 +407,7 @@ static ssize_t set_packets_per_xact_show(struct device *dev,
 					 struct device_attribute *attr,
 					 char *buf)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 
 	return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.packets_per_xact);
 }
@@ -417,7 +417,7 @@ static ssize_t set_packets_per_xact_store(struct device *dev,
 					  const char *buf,
 					  size_t count)
 {
-	struct most_c_obj *c = to_c_obj(dev);
+	struct most_channel *c = to_channel(dev);
 	int ret = kstrtou16(buf, 0, &c->cfg.packets_per_xact);
 
 	if (ret)
@@ -535,7 +535,7 @@ static const struct attribute_group *interface_attr_groups[] = {
 static ssize_t links_show(struct device *dev, struct device_attribute *attr,
 			  char *buf)
 {
-	struct most_c_obj *c;
+	struct most_channel *c;
 	struct most_inst_obj *i;
 	struct most_aim *aim = to_most_aim(dev);
 	int offs = 0;
@@ -599,10 +599,9 @@ static int split_string(char *buf, char **a, char **b, char **c)
  *
  * This retrieves the pointer to a channel object.
  */
-static struct
-most_c_obj *get_channel_by_name(char *mdev, char *mdev_ch)
+static struct most_channel *get_channel_by_name(char *mdev, char *mdev_ch)
 {
-	struct most_c_obj *c, *tmp;
+	struct most_channel *c, *tmp;
 	struct most_inst_obj *i, *i_tmp;
 	int found = 0;
 
@@ -626,8 +625,9 @@ most_c_obj *get_channel_by_name(char *mdev, char *mdev_ch)
 	return c;
 }
 
-static inline int link_channel_to_aim(struct most_c_obj *c,
-				      struct most_aim *aim, char *aim_param)
+static
+inline int link_channel_to_aim(struct most_channel *c, struct most_aim *aim,
+			       char *aim_param)
 {
 	int ret;
 	struct most_aim **aim_ptr;
@@ -677,7 +677,7 @@ static ssize_t add_link_store(struct device *dev,
 			      const char *buf,
 			      size_t len)
 {
-	struct most_c_obj *c;
+	struct most_channel *c;
 	struct most_aim *aim = to_most_aim(dev);
 	char buffer[STRING_SIZE];
 	char *mdev;
@@ -725,7 +725,7 @@ static ssize_t remove_link_store(struct device *dev,
 				 const char *buf,
 				 size_t len)
 {
-	struct most_c_obj *c;
+	struct most_channel *c;
 	struct most_aim *aim = to_most_aim(dev);
 	char buffer[STRING_SIZE];
 	char *mdev;
@@ -802,14 +802,14 @@ static struct device_driver mostcore = {
 static inline void trash_mbo(struct mbo *mbo)
 {
 	unsigned long flags;
-	struct most_c_obj *c = mbo->context;
+	struct most_channel *c = mbo->context;
 
 	spin_lock_irqsave(&c->fifo_lock, flags);
 	list_add(&mbo->list, &c->trash_fifo);
 	spin_unlock_irqrestore(&c->fifo_lock, flags);
 }
 
-static bool hdm_mbo_ready(struct most_c_obj *c)
+static bool hdm_mbo_ready(struct most_channel *c)
 {
 	bool empty;
 
@@ -826,7 +826,7 @@ static bool hdm_mbo_ready(struct most_c_obj *c)
 static void nq_hdm_mbo(struct mbo *mbo)
 {
 	unsigned long flags;
-	struct most_c_obj *c = mbo->context;
+	struct most_channel *c = mbo->context;
 
 	spin_lock_irqsave(&c->fifo_lock, flags);
 	list_add_tail(&mbo->list, &c->halt_fifo);
@@ -836,7 +836,7 @@ static void nq_hdm_mbo(struct mbo *mbo)
 
 static int hdm_enqueue_thread(void *data)
 {
-	struct most_c_obj *c = data;
+	struct most_channel *c = data;
 	struct mbo *mbo;
 	int ret;
 	typeof(c->iface->enqueue) enqueue = c->iface->enqueue;
@@ -874,7 +874,7 @@ static int hdm_enqueue_thread(void *data)
 	return 0;
 }
 
-static int run_enqueue_thread(struct most_c_obj *c, int channel_id)
+static int run_enqueue_thread(struct most_channel *c, int channel_id)
 {
 	struct task_struct *task =
 		kthread_run(hdm_enqueue_thread, c, "hdm_fifo_%d",
@@ -901,7 +901,7 @@ static int run_enqueue_thread(struct most_c_obj *c, int channel_id)
 static void arm_mbo(struct mbo *mbo)
 {
 	unsigned long flags;
-	struct most_c_obj *c;
+	struct most_channel *c;
 
 	BUG_ON((!mbo) || (!mbo->context));
 	c = mbo->context;
@@ -936,7 +936,7 @@ static void arm_mbo(struct mbo *mbo)
  *
  * Returns the number of allocated and enqueued MBOs.
  */
-static int arm_mbo_chain(struct most_c_obj *c, int dir,
+static int arm_mbo_chain(struct most_channel *c, int dir,
 			 void (*compl)(struct mbo *))
 {
 	unsigned int i;
@@ -1004,7 +1004,7 @@ EXPORT_SYMBOL_GPL(most_submit_mbo);
  */
 static void most_write_completion(struct mbo *mbo)
 {
-	struct most_c_obj *c;
+	struct most_channel *c;
 
 	BUG_ON((!mbo) || (!mbo->context));
 
@@ -1020,7 +1020,7 @@ static void most_write_completion(struct mbo *mbo)
 int channel_has_mbo(struct most_interface *iface, int id, struct most_aim *aim)
 {
 	struct most_inst_obj *inst = iface->priv;
-	struct most_c_obj *c = inst->channel[id];
+	struct most_channel *c = inst->channel[id];
 	unsigned long flags;
 	int empty;
 
@@ -1051,7 +1051,7 @@ struct mbo *most_get_mbo(struct most_interface *iface, int id,
 			 struct most_aim *aim)
 {
 	struct mbo *mbo;
-	struct most_c_obj *c;
+	struct most_channel *c;
 	struct most_inst_obj *inst = iface->priv;
 	unsigned long flags;
 	int *num_buffers_ptr;
@@ -1093,7 +1093,7 @@ EXPORT_SYMBOL_GPL(most_get_mbo);
  */
 void most_put_mbo(struct mbo *mbo)
 {
-	struct most_c_obj *c = mbo->context;
+	struct most_channel *c = mbo->context;
 
 	if (c->cfg.direction == MOST_CH_TX) {
 		arm_mbo(mbo);
@@ -1116,7 +1116,7 @@ EXPORT_SYMBOL_GPL(most_put_mbo);
  */
 static void most_read_completion(struct mbo *mbo)
 {
-	struct most_c_obj *c = mbo->context;
+	struct most_channel *c = mbo->context;
 
 	if (unlikely(c->is_poisoned || (mbo->status == MBO_E_CLOSE))) {
 		trash_mbo(mbo);
@@ -1159,7 +1159,7 @@ int most_start_channel(struct most_interface *iface, int id,
 	int num_buffer;
 	int ret;
 	struct most_inst_obj *inst = iface->priv;
-	struct most_c_obj *c = inst->channel[id];
+	struct most_channel *c = inst->channel[id];
 
 	if (unlikely(!c))
 		return -EINVAL;
@@ -1228,7 +1228,7 @@ int most_stop_channel(struct most_interface *iface, int id,
 		      struct most_aim *aim)
 {
 	struct most_inst_obj *inst;
-	struct most_c_obj *c;
+	struct most_channel *c;
 
 	if (unlikely((!iface) || (id >= iface->num_channels) || (id < 0))) {
 		pr_err("Bad interface or index out of range\n");
@@ -1320,7 +1320,7 @@ EXPORT_SYMBOL_GPL(most_register_aim);
  */
 int most_deregister_aim(struct most_aim *aim)
 {
-	struct most_c_obj *c, *tmp;
+	struct most_channel *c, *tmp;
 	struct most_inst_obj *i, *i_tmp;
 
 	if (!aim) {
@@ -1368,7 +1368,7 @@ int most_register_interface(struct most_interface *iface)
 	int id;
 	char name[STRING_SIZE];
 	char channel_name[STRING_SIZE];
-	struct most_c_obj *c;
+	struct most_channel *c;
 	struct most_inst_obj *inst;
 
 	if (!iface || !iface->enqueue || !iface->configure ||
@@ -1474,7 +1474,7 @@ EXPORT_SYMBOL_GPL(most_register_interface);
 void most_deregister_interface(struct most_interface *iface)
 {
 	int i;
-	struct most_c_obj *c;
+	struct most_channel *c;
 	struct most_inst_obj *inst;
 
 	pr_info("deregistering MOST device %s (%s)\n", dev_name(&iface->dev), iface->description);
@@ -1513,7 +1513,7 @@ EXPORT_SYMBOL_GPL(most_deregister_interface);
 void most_stop_enqueue(struct most_interface *iface, int id)
 {
 	struct most_inst_obj *inst = iface->priv;
-	struct most_c_obj *c = inst->channel[id];
+	struct most_channel *c = inst->channel[id];
 
 	if (!c)
 		return;
@@ -1535,7 +1535,7 @@ EXPORT_SYMBOL_GPL(most_stop_enqueue);
 void most_resume_enqueue(struct most_interface *iface, int id)
 {
 	struct most_inst_obj *inst = iface->priv;
-	struct most_c_obj *c = inst->channel[id];
+	struct most_channel *c = inst->channel[id];
 
 	if (!c)
 		return;
-- 
2.7.4

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

* [PATCH 14/50] staging: most: core: rename struct most_c_aim_obj to pipe
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (12 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 13/50] staging: most: core: rename structure Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 15/50] staging: most: core: rename struct memeber Christian Gromm
                   ` (37 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch replaces the confusing name of struct "most_c_aim_obj" with
"pipe" to better express the function that is behind the structure.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index f7aa5ad..5b51cd3 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -37,7 +37,7 @@ static struct device core_dev;
 static struct ida mdev_id;
 static int dummy_num_buffers;
 
-struct most_c_aim_obj {
+struct pipe {
 	struct most_aim *ptr;
 	int refs;
 	int num_buffers;
@@ -62,8 +62,8 @@ struct most_channel {
 	spinlock_t fifo_lock;
 	struct list_head halt_fifo;
 	struct list_head list;
-	struct most_c_aim_obj aim0;
-	struct most_c_aim_obj aim1;
+	struct pipe aim0;
+	struct pipe aim1;
 	struct list_head trash_fifo;
 	struct task_struct *hdm_enqueue_task;
 	wait_queue_head_t hdm_fifo_wq;
-- 
2.7.4

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

* [PATCH 15/50] staging: most: core: rename struct memeber
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (13 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 14/50] staging: most: core: rename struct most_c_aim_obj to pipe Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 16/50] staging: most: core: rename members aim* of struct most_channel Christian Gromm
                   ` (36 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the member "ptr" of struct pipe to "aim". This is needed
to increase the readability of the code.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 78 ++++++++++++++++++++++-----------------------
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 5b51cd3..193e4ad 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -38,7 +38,7 @@ static struct ida mdev_id;
 static int dummy_num_buffers;
 
 struct pipe {
-	struct most_aim *ptr;
+	struct most_aim *aim;
 	int refs;
 	int num_buffers;
 };
@@ -542,7 +542,7 @@ static ssize_t links_show(struct device *dev, struct device_attribute *attr,
 
 	list_for_each_entry(i, &instance_list, list) {
 		list_for_each_entry(c, &i->channel_list, list) {
-			if (c->aim0.ptr == aim || c->aim1.ptr == aim) {
+			if (c->aim0.aim == aim || c->aim1.aim == aim) {
 				offs += snprintf(buf + offs, PAGE_SIZE - offs,
 						 "%s:%s\n",
 						 dev_name(&i->iface->dev),
@@ -632,10 +632,10 @@ inline int link_channel_to_aim(struct most_channel *c, struct most_aim *aim,
 	int ret;
 	struct most_aim **aim_ptr;
 
-	if (!c->aim0.ptr)
-		aim_ptr = &c->aim0.ptr;
-	else if (!c->aim1.ptr)
-		aim_ptr = &c->aim1.ptr;
+	if (!c->aim0.aim)
+		aim_ptr = &c->aim0.aim;
+	else if (!c->aim1.aim)
+		aim_ptr = &c->aim1.aim;
 	else
 		return -ENOSPC;
 
@@ -744,10 +744,10 @@ static ssize_t remove_link_store(struct device *dev,
 
 	if (aim->disconnect_channel(c->iface, c->channel_id))
 		return -EIO;
-	if (c->aim0.ptr == aim)
-		c->aim0.ptr = NULL;
-	if (c->aim1.ptr == aim)
-		c->aim1.ptr = NULL;
+	if (c->aim0.aim == aim)
+		c->aim0.aim = NULL;
+	if (c->aim1.aim == aim)
+		c->aim1.aim = NULL;
 	return len;
 }
 
@@ -916,11 +916,11 @@ static void arm_mbo(struct mbo *mbo)
 	list_add_tail(&mbo->list, &c->fifo);
 	spin_unlock_irqrestore(&c->fifo_lock, flags);
 
-	if (c->aim0.refs && c->aim0.ptr->tx_completion)
-		c->aim0.ptr->tx_completion(c->iface, c->channel_id);
+	if (c->aim0.refs && c->aim0.aim->tx_completion)
+		c->aim0.aim->tx_completion(c->iface, c->channel_id);
 
-	if (c->aim1.refs && c->aim1.ptr->tx_completion)
-		c->aim1.ptr->tx_completion(c->iface, c->channel_id);
+	if (c->aim1.refs && c->aim1.aim->tx_completion)
+		c->aim1.aim->tx_completion(c->iface, c->channel_id);
 }
 
 /**
@@ -1028,8 +1028,8 @@ int channel_has_mbo(struct most_interface *iface, int id, struct most_aim *aim)
 		return -EINVAL;
 
 	if (c->aim0.refs && c->aim1.refs &&
-	    ((aim == c->aim0.ptr && c->aim0.num_buffers <= 0) ||
-	     (aim == c->aim1.ptr && c->aim1.num_buffers <= 0)))
+	    ((aim == c->aim0.aim && c->aim0.num_buffers <= 0) ||
+	     (aim == c->aim1.aim && c->aim1.num_buffers <= 0)))
 		return 0;
 
 	spin_lock_irqsave(&c->fifo_lock, flags);
@@ -1061,13 +1061,13 @@ struct mbo *most_get_mbo(struct most_interface *iface, int id,
 		return NULL;
 
 	if (c->aim0.refs && c->aim1.refs &&
-	    ((aim == c->aim0.ptr && c->aim0.num_buffers <= 0) ||
-	     (aim == c->aim1.ptr && c->aim1.num_buffers <= 0)))
+	    ((aim == c->aim0.aim && c->aim0.num_buffers <= 0) ||
+	     (aim == c->aim1.aim && c->aim1.num_buffers <= 0)))
 		return NULL;
 
-	if (aim == c->aim0.ptr)
+	if (aim == c->aim0.aim)
 		num_buffers_ptr = &c->aim0.num_buffers;
-	else if (aim == c->aim1.ptr)
+	else if (aim == c->aim1.aim)
 		num_buffers_ptr = &c->aim1.num_buffers;
 	else
 		num_buffers_ptr = &dummy_num_buffers;
@@ -1132,12 +1132,12 @@ static void most_read_completion(struct mbo *mbo)
 	if (atomic_sub_and_test(1, &c->mbo_nq_level))
 		c->is_starving = 1;
 
-	if (c->aim0.refs && c->aim0.ptr->rx_completion &&
-	    c->aim0.ptr->rx_completion(mbo) == 0)
+	if (c->aim0.refs && c->aim0.aim->rx_completion &&
+	    c->aim0.aim->rx_completion(mbo) == 0)
 		return;
 
-	if (c->aim1.refs && c->aim1.ptr->rx_completion &&
-	    c->aim1.ptr->rx_completion(mbo) == 0)
+	if (c->aim1.refs && c->aim1.aim->rx_completion &&
+	    c->aim1.aim->rx_completion(mbo) == 0)
 		return;
 
 	most_put_mbo(mbo);
@@ -1205,9 +1205,9 @@ int most_start_channel(struct most_interface *iface, int id,
 	atomic_set(&c->mbo_ref, num_buffer);
 
 out:
-	if (aim == c->aim0.ptr)
+	if (aim == c->aim0.aim)
 		c->aim0.refs++;
-	if (aim == c->aim1.ptr)
+	if (aim == c->aim1.aim)
 		c->aim1.refs++;
 	mutex_unlock(&c->start_mutex);
 	return 0;
@@ -1272,9 +1272,9 @@ int most_stop_channel(struct most_interface *iface, int id,
 	c->is_poisoned = false;
 
 out:
-	if (aim == c->aim0.ptr)
+	if (aim == c->aim0.aim)
 		c->aim0.refs--;
-	if (aim == c->aim1.ptr)
+	if (aim == c->aim1.aim)
 		c->aim1.refs--;
 	mutex_unlock(&c->start_mutex);
 	return 0;
@@ -1330,13 +1330,13 @@ int most_deregister_aim(struct most_aim *aim)
 
 	list_for_each_entry_safe(i, i_tmp, &instance_list, list) {
 		list_for_each_entry_safe(c, tmp, &i->channel_list, list) {
-			if (c->aim0.ptr == aim || c->aim1.ptr == aim)
+			if (c->aim0.aim == aim || c->aim1.aim == aim)
 				aim->disconnect_channel(
 					c->iface, c->channel_id);
-			if (c->aim0.ptr == aim)
-				c->aim0.ptr = NULL;
-			if (c->aim1.ptr == aim)
-				c->aim1.ptr = NULL;
+			if (c->aim0.aim == aim)
+				c->aim0.aim = NULL;
+			if (c->aim1.aim == aim)
+				c->aim1.aim = NULL;
 		}
 	}
 	device_unregister(&aim->dev);
@@ -1481,14 +1481,14 @@ void most_deregister_interface(struct most_interface *iface)
 	inst = iface->priv;
 	for (i = 0; i < iface->num_channels; i++) {
 		c = inst->channel[i];
-		if (c->aim0.ptr)
-			c->aim0.ptr->disconnect_channel(c->iface,
+		if (c->aim0.aim)
+			c->aim0.aim->disconnect_channel(c->iface,
 							c->channel_id);
-		if (c->aim1.ptr)
-			c->aim1.ptr->disconnect_channel(c->iface,
+		if (c->aim1.aim)
+			c->aim1.aim->disconnect_channel(c->iface,
 							c->channel_id);
-		c->aim0.ptr = NULL;
-		c->aim1.ptr = NULL;
+		c->aim0.aim = NULL;
+		c->aim1.aim = NULL;
 		list_del(&c->list);
 		device_unregister(&c->dev);
 		kfree(c);
-- 
2.7.4

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

* [PATCH 16/50] staging: most: core: rename members aim* of struct most_channel
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (14 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 15/50] staging: most: core: rename struct memeber Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 17/50] staging: most: core: use structure to pack driver specific data Christian Gromm
                   ` (35 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the struct members "aim0" and "aim0" to "pipe0" and
"pipe1".  It is needed to have a conclusive nomenclature of the struct and
its instances.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 104 ++++++++++++++++++++++----------------------
 1 file changed, 52 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 193e4ad..2b923fb 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -62,8 +62,8 @@ struct most_channel {
 	spinlock_t fifo_lock;
 	struct list_head halt_fifo;
 	struct list_head list;
-	struct pipe aim0;
-	struct pipe aim1;
+	struct pipe pipe0;
+	struct pipe pipe1;
 	struct list_head trash_fifo;
 	struct task_struct *hdm_enqueue_task;
 	wait_queue_head_t hdm_fifo_wq;
@@ -542,7 +542,7 @@ static ssize_t links_show(struct device *dev, struct device_attribute *attr,
 
 	list_for_each_entry(i, &instance_list, list) {
 		list_for_each_entry(c, &i->channel_list, list) {
-			if (c->aim0.aim == aim || c->aim1.aim == aim) {
+			if (c->pipe0.aim == aim || c->pipe1.aim == aim) {
 				offs += snprintf(buf + offs, PAGE_SIZE - offs,
 						 "%s:%s\n",
 						 dev_name(&i->iface->dev),
@@ -632,10 +632,10 @@ inline int link_channel_to_aim(struct most_channel *c, struct most_aim *aim,
 	int ret;
 	struct most_aim **aim_ptr;
 
-	if (!c->aim0.aim)
-		aim_ptr = &c->aim0.aim;
-	else if (!c->aim1.aim)
-		aim_ptr = &c->aim1.aim;
+	if (!c->pipe0.aim)
+		aim_ptr = &c->pipe0.aim;
+	else if (!c->pipe1.aim)
+		aim_ptr = &c->pipe1.aim;
 	else
 		return -ENOSPC;
 
@@ -744,10 +744,10 @@ static ssize_t remove_link_store(struct device *dev,
 
 	if (aim->disconnect_channel(c->iface, c->channel_id))
 		return -EIO;
-	if (c->aim0.aim == aim)
-		c->aim0.aim = NULL;
-	if (c->aim1.aim == aim)
-		c->aim1.aim = NULL;
+	if (c->pipe0.aim == aim)
+		c->pipe0.aim = NULL;
+	if (c->pipe1.aim == aim)
+		c->pipe1.aim = NULL;
 	return len;
 }
 
@@ -916,11 +916,11 @@ static void arm_mbo(struct mbo *mbo)
 	list_add_tail(&mbo->list, &c->fifo);
 	spin_unlock_irqrestore(&c->fifo_lock, flags);
 
-	if (c->aim0.refs && c->aim0.aim->tx_completion)
-		c->aim0.aim->tx_completion(c->iface, c->channel_id);
+	if (c->pipe0.refs && c->pipe0.aim->tx_completion)
+		c->pipe0.aim->tx_completion(c->iface, c->channel_id);
 
-	if (c->aim1.refs && c->aim1.aim->tx_completion)
-		c->aim1.aim->tx_completion(c->iface, c->channel_id);
+	if (c->pipe1.refs && c->pipe1.aim->tx_completion)
+		c->pipe1.aim->tx_completion(c->iface, c->channel_id);
 }
 
 /**
@@ -1027,9 +1027,9 @@ int channel_has_mbo(struct most_interface *iface, int id, struct most_aim *aim)
 	if (unlikely(!c))
 		return -EINVAL;
 
-	if (c->aim0.refs && c->aim1.refs &&
-	    ((aim == c->aim0.aim && c->aim0.num_buffers <= 0) ||
-	     (aim == c->aim1.aim && c->aim1.num_buffers <= 0)))
+	if (c->pipe0.refs && c->pipe1.refs &&
+	    ((aim == c->pipe0.aim && c->pipe0.num_buffers <= 0) ||
+	     (aim == c->pipe1.aim && c->pipe1.num_buffers <= 0)))
 		return 0;
 
 	spin_lock_irqsave(&c->fifo_lock, flags);
@@ -1060,15 +1060,15 @@ struct mbo *most_get_mbo(struct most_interface *iface, int id,
 	if (unlikely(!c))
 		return NULL;
 
-	if (c->aim0.refs && c->aim1.refs &&
-	    ((aim == c->aim0.aim && c->aim0.num_buffers <= 0) ||
-	     (aim == c->aim1.aim && c->aim1.num_buffers <= 0)))
+	if (c->pipe0.refs && c->pipe1.refs &&
+	    ((aim == c->pipe0.aim && c->pipe0.num_buffers <= 0) ||
+	     (aim == c->pipe1.aim && c->pipe1.num_buffers <= 0)))
 		return NULL;
 
-	if (aim == c->aim0.aim)
-		num_buffers_ptr = &c->aim0.num_buffers;
-	else if (aim == c->aim1.aim)
-		num_buffers_ptr = &c->aim1.num_buffers;
+	if (aim == c->pipe0.aim)
+		num_buffers_ptr = &c->pipe0.num_buffers;
+	else if (aim == c->pipe1.aim)
+		num_buffers_ptr = &c->pipe1.num_buffers;
 	else
 		num_buffers_ptr = &dummy_num_buffers;
 
@@ -1132,12 +1132,12 @@ static void most_read_completion(struct mbo *mbo)
 	if (atomic_sub_and_test(1, &c->mbo_nq_level))
 		c->is_starving = 1;
 
-	if (c->aim0.refs && c->aim0.aim->rx_completion &&
-	    c->aim0.aim->rx_completion(mbo) == 0)
+	if (c->pipe0.refs && c->pipe0.aim->rx_completion &&
+	    c->pipe0.aim->rx_completion(mbo) == 0)
 		return;
 
-	if (c->aim1.refs && c->aim1.aim->rx_completion &&
-	    c->aim1.aim->rx_completion(mbo) == 0)
+	if (c->pipe1.refs && c->pipe1.aim->rx_completion &&
+	    c->pipe1.aim->rx_completion(mbo) == 0)
 		return;
 
 	most_put_mbo(mbo);
@@ -1165,7 +1165,7 @@ int most_start_channel(struct most_interface *iface, int id,
 		return -EINVAL;
 
 	mutex_lock(&c->start_mutex);
-	if (c->aim0.refs + c->aim1.refs > 0)
+	if (c->pipe0.refs + c->pipe1.refs > 0)
 		goto out; /* already started by other aim */
 
 	if (!try_module_get(iface->mod)) {
@@ -1200,15 +1200,15 @@ int most_start_channel(struct most_interface *iface, int id,
 		goto error;
 
 	c->is_starving = 0;
-	c->aim0.num_buffers = c->cfg.num_buffers / 2;
-	c->aim1.num_buffers = c->cfg.num_buffers - c->aim0.num_buffers;
+	c->pipe0.num_buffers = c->cfg.num_buffers / 2;
+	c->pipe1.num_buffers = c->cfg.num_buffers - c->pipe0.num_buffers;
 	atomic_set(&c->mbo_ref, num_buffer);
 
 out:
-	if (aim == c->aim0.aim)
-		c->aim0.refs++;
-	if (aim == c->aim1.aim)
-		c->aim1.refs++;
+	if (aim == c->pipe0.aim)
+		c->pipe0.refs++;
+	if (aim == c->pipe1.aim)
+		c->pipe1.refs++;
 	mutex_unlock(&c->start_mutex);
 	return 0;
 
@@ -1240,7 +1240,7 @@ int most_stop_channel(struct most_interface *iface, int id,
 		return -EINVAL;
 
 	mutex_lock(&c->start_mutex);
-	if (c->aim0.refs + c->aim1.refs >= 2)
+	if (c->pipe0.refs + c->pipe1.refs >= 2)
 		goto out;
 
 	if (c->hdm_enqueue_task)
@@ -1272,10 +1272,10 @@ int most_stop_channel(struct most_interface *iface, int id,
 	c->is_poisoned = false;
 
 out:
-	if (aim == c->aim0.aim)
-		c->aim0.refs--;
-	if (aim == c->aim1.aim)
-		c->aim1.refs--;
+	if (aim == c->pipe0.aim)
+		c->pipe0.refs--;
+	if (aim == c->pipe1.aim)
+		c->pipe1.refs--;
 	mutex_unlock(&c->start_mutex);
 	return 0;
 }
@@ -1330,13 +1330,13 @@ int most_deregister_aim(struct most_aim *aim)
 
 	list_for_each_entry_safe(i, i_tmp, &instance_list, list) {
 		list_for_each_entry_safe(c, tmp, &i->channel_list, list) {
-			if (c->aim0.aim == aim || c->aim1.aim == aim)
+			if (c->pipe0.aim == aim || c->pipe1.aim == aim)
 				aim->disconnect_channel(
 					c->iface, c->channel_id);
-			if (c->aim0.aim == aim)
-				c->aim0.aim = NULL;
-			if (c->aim1.aim == aim)
-				c->aim1.aim = NULL;
+			if (c->pipe0.aim == aim)
+				c->pipe0.aim = NULL;
+			if (c->pipe1.aim == aim)
+				c->pipe1.aim = NULL;
 		}
 	}
 	device_unregister(&aim->dev);
@@ -1481,14 +1481,14 @@ void most_deregister_interface(struct most_interface *iface)
 	inst = iface->priv;
 	for (i = 0; i < iface->num_channels; i++) {
 		c = inst->channel[i];
-		if (c->aim0.aim)
-			c->aim0.aim->disconnect_channel(c->iface,
+		if (c->pipe0.aim)
+			c->pipe0.aim->disconnect_channel(c->iface,
 							c->channel_id);
-		if (c->aim1.aim)
-			c->aim1.aim->disconnect_channel(c->iface,
+		if (c->pipe1.aim)
+			c->pipe1.aim->disconnect_channel(c->iface,
 							c->channel_id);
-		c->aim0.aim = NULL;
-		c->aim1.aim = NULL;
+		c->pipe0.aim = NULL;
+		c->pipe1.aim = NULL;
 		list_del(&c->list);
 		device_unregister(&c->dev);
 		kfree(c);
-- 
2.7.4

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

* [PATCH 17/50] staging: most: core: use structure to pack driver specific data
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (15 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 16/50] staging: most: core: rename members aim* of struct most_channel Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 18/50] staging: most: core: track aim modules with linked list Christian Gromm
                   ` (34 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch introduces the structure "mostcore" to bundle core specific
data structures.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 73 +++++++++++++++++++++------------------------
 1 file changed, 34 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 2b923fb..9a313cc 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -32,11 +32,19 @@
 #define MAX_CHANNELS	64
 #define STRING_SIZE	80
 
-static struct class *most_class;
-static struct device core_dev;
 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 class *class;
+	struct list_head mod_list;
+} mc;
+
+#define to_driver(d) container_of(d, struct mostcore, drv);
+
 struct pipe {
 	struct most_aim *aim;
 	int refs;
@@ -783,22 +791,6 @@ int most_match(struct device *dev, struct device_driver *drv)
 		return 1;
 }
 
-/**
- * Instantiation of the MOST bus
- */
-static struct bus_type most_bus = {
-	.name = "most",
-	.match = most_match,
-};
-
-/**
- * Instantiation of the core driver
- */
-static struct device_driver mostcore = {
-	.name = "mostcore",
-	.bus = &most_bus,
-};
-
 static inline void trash_mbo(struct mbo *mbo)
 {
 	unsigned long flags;
@@ -1299,8 +1291,8 @@ int most_register_aim(struct most_aim *aim)
 		return -EINVAL;
 	}
 	aim->dev.init_name = aim->name;
-	aim->dev.bus = &most_bus;
-	aim->dev.parent = &core_dev;
+	aim->dev.bus = &mc.bus;
+	aim->dev.parent = &mc.dev;
 	aim->dev.groups = aim_attr_groups;
 	aim->dev.release = release_aim;
 	ret = device_register(&aim->dev);
@@ -1397,8 +1389,8 @@ int most_register_interface(struct most_interface *iface)
 	list_add_tail(&inst->list, &instance_list);
 	snprintf(name, STRING_SIZE, "mdev%d", id);
 	iface->dev.init_name = name;
-	iface->dev.bus = &most_bus;
-	iface->dev.parent = &core_dev;
+	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)) {
@@ -1561,28 +1553,31 @@ static int __init most_init(void)
 	INIT_LIST_HEAD(&instance_list);
 	ida_init(&mdev_id);
 
-	err = bus_register(&most_bus);
+	mc.bus.name = "most",
+	mc.bus.match = most_match,
+	mc.drv.name = "most_core",
+	mc.drv.bus = &mc.bus,
+
+	err = bus_register(&mc.bus);
 	if (err) {
 		pr_info("Cannot register most bus\n");
 		return err;
 	}
-
-	most_class = class_create(THIS_MODULE, "most");
-	if (IS_ERR(most_class)) {
+	mc.class = class_create(THIS_MODULE, "most");
+	if (IS_ERR(mc.class)) {
 		pr_info("No udev support.\n");
-		err = PTR_ERR(most_class);
+		err = PTR_ERR(mc.class);
 		goto exit_bus;
 	}
 
-	err = driver_register(&mostcore);
+	err = driver_register(&mc.drv);
 	if (err) {
 		pr_info("Cannot register core driver\n");
 		goto exit_class;
 	}
-
-	core_dev.init_name = "most_bus";
-	core_dev.release = release_most_sub;
-	if (device_register(&core_dev)) {
+	mc.dev.init_name = "most_bus";
+	mc.dev.release = release_most_sub;
+	if (device_register(&mc.dev)) {
 		err = -ENOMEM;
 		goto exit_driver;
 	}
@@ -1590,21 +1585,21 @@ static int __init most_init(void)
 	return 0;
 
 exit_driver:
-	driver_unregister(&mostcore);
+	driver_unregister(&mc.drv);
 exit_class:
-	class_destroy(most_class);
+	class_destroy(mc.class);
 exit_bus:
-	bus_unregister(&most_bus);
+	bus_unregister(&mc.bus);
 	return err;
 }
 
 static void __exit most_exit(void)
 {
 	pr_info("exit core module\n");
-	device_unregister(&core_dev);
-	driver_unregister(&mostcore);
-	class_destroy(most_class);
-	bus_unregister(&most_bus);
+	device_unregister(&mc.dev);
+	driver_unregister(&mc.drv);
+	class_destroy(mc.class);
+	bus_unregister(&mc.bus);
 	ida_destroy(&mdev_id);
 }
 
-- 
2.7.4

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

* [PATCH 18/50] staging: most: core: track aim modules with linked list
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (16 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 17/50] staging: most: core: use structure to pack driver specific data Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 19/50] staging: most: core: fix sysfs attribute management Christian Gromm
                   ` (33 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

The core needs to know what modules are registered. This patch makes the
core keep track of the registered modules.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 6 ++++--
 drivers/staging/most/core.h | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 9a313cc..b9b9739 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -1300,8 +1300,8 @@ int most_register_aim(struct most_aim *aim)
 		pr_err("registering device %s failed\n", aim->name);
 		return ret;
 	}
-	pr_info("registered new application interfacing module %s\n",
-		aim->name);
+	list_add_tail(&aim->list, &mc.mod_list);
+	pr_info("registered new application interfacing module %s\n", aim->name);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(most_register_aim);
@@ -1332,6 +1332,7 @@ int most_deregister_aim(struct most_aim *aim)
 		}
 	}
 	device_unregister(&aim->dev);
+	list_del(&aim->list);
 	pr_info("deregistering application interfacing module %s\n", aim->name);
 	return 0;
 }
@@ -1551,6 +1552,7 @@ static int __init most_init(void)
 
 	pr_info("init()\n");
 	INIT_LIST_HEAD(&instance_list);
+	INIT_LIST_HEAD(&mc.mod_list);
 	ida_init(&mdev_id);
 
 	mc.bus.name = "most",
diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h
index b392ba5..0199be0 100644
--- a/drivers/staging/most/core.h
+++ b/drivers/staging/most/core.h
@@ -269,6 +269,7 @@ struct most_interface {
  */
 struct most_aim {
 	struct device dev;
+	struct list_head list;
 	const char *name;
 	int (*probe_channel)(struct most_interface *iface, int channel_idx,
 			     struct most_channel_config *cfg, char *name);
-- 
2.7.4

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

* [PATCH 19/50] staging: most: core: fix sysfs attribute management
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (17 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 18/50] staging: most: core: track aim modules with linked list Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 20/50] staging: most: core: remove struct device Christian Gromm
                   ` (32 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch creates a new attribute group to manage the attributes
of a registered aim module in sysfs and changes the show and store
functions accordingly.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 109 +++++++++++++++++++++++++++++---------------
 1 file changed, 73 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index b9b9739..7014f6a 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -540,28 +540,57 @@ static const struct attribute_group *interface_attr_groups[] = {
 /*		     ___     ___
  *		     ___A I M___
  */
-static ssize_t links_show(struct device *dev, struct device_attribute *attr,
-			  char *buf)
+static struct most_aim *match_module(char *name)
+{
+	struct most_aim *aim;
+
+	list_for_each_entry(aim, &mc.mod_list, list) {
+		if (!strcmp(aim->name, name))
+			return aim;
+	}
+	return NULL;
+}
+
+static ssize_t links_show(struct device_driver *drv, char *buf)
 {
 	struct most_channel *c;
 	struct most_inst_obj *i;
-	struct most_aim *aim = to_most_aim(dev);
 	int offs = 0;
 
 	list_for_each_entry(i, &instance_list, list) {
 		list_for_each_entry(c, &i->channel_list, list) {
-			if (c->pipe0.aim == aim || c->pipe1.aim == aim) {
-				offs += snprintf(buf + offs, PAGE_SIZE - offs,
-						 "%s:%s\n",
+			if (c->pipe0.aim) {
+				offs += snprintf(buf + offs,
+						 PAGE_SIZE - offs,
+						 "%s:%s:%s\n",
+						 c->pipe0.aim->name,
+						 dev_name(&i->iface->dev),
+						 dev_name(&c->dev));
+			}
+			if (c->pipe1.aim) {
+				offs += snprintf(buf + offs,
+						 PAGE_SIZE - offs,
+						 "%s:%s:%s\n",
+						 c->pipe1.aim->name,
 						 dev_name(&i->iface->dev),
 						 dev_name(&c->dev));
 			}
 		}
 	}
-
 	return offs;
 }
 
+static ssize_t modules_show(struct device_driver *drv, char *buf)
+{
+	struct most_aim *aim;
+	int offs = 0;
+
+	list_for_each_entry(aim, &mc.mod_list, list) {
+		offs += snprintf(buf + offs, PAGE_SIZE - offs, "%s\n",
+				 aim->name);
+	}
+	return offs;
+}
 /**
  * split_string - parses and changes string in the buffer buf and
  * splits it into two mandatory and one optional substrings.
@@ -584,7 +613,7 @@ static ssize_t links_show(struct device *dev, struct device_attribute *attr,
  * Input: "mdev1:ep81"
  * Output: *a -> "mdev1", *b -> "ep81", *c == NULL
  */
-static int split_string(char *buf, char **a, char **b, char **c)
+static int split_string(char *buf, char **a, char **b, char **c, char **d)
 {
 	*a = strsep(&buf, ":");
 	if (!*a)
@@ -594,8 +623,12 @@ static int split_string(char *buf, char **a, char **b, char **c)
 	if (!*b)
 		return -EIO;
 
-	if (c)
-		*c = strsep(&buf, ":\n");
+	*c = strsep(&buf, ":\n");
+	if (!*c)
+		return -EIO;
+
+	if (d)
+		*d = strsep(&buf, ":\n");
 
 	return 0;
 }
@@ -680,38 +713,38 @@ inline int link_channel_to_aim(struct most_channel *c, struct most_aim *aim,
  * (1) would create the device node /dev/my_rxchannel
  * (2) would create the device node /dev/mdev1-ep81
  */
-static ssize_t add_link_store(struct device *dev,
-			      struct device_attribute *attr,
+static ssize_t add_link_store(struct device_driver *drv,
 			      const char *buf,
 			      size_t len)
 {
 	struct most_channel *c;
-	struct most_aim *aim = to_most_aim(dev);
+	struct most_aim *aim;
 	char buffer[STRING_SIZE];
 	char *mdev;
 	char *mdev_ch;
-	char *mdev_devnod;
+	char *aim_name;
+	char *aim_param;
 	char devnod_buf[STRING_SIZE];
 	int ret;
 	size_t max_len = min_t(size_t, len + 1, STRING_SIZE);
 
 	strlcpy(buffer, buf, max_len);
 
-	ret = split_string(buffer, &mdev, &mdev_ch, &mdev_devnod);
+	ret = split_string(buffer, &mdev, &mdev_ch, &aim_name, &aim_param);
 	if (ret)
 		return ret;
-
-	if (!mdev_devnod || *mdev_devnod == 0) {
+	aim = match_module(aim_name);
+	if (!aim_param || *aim_param == 0) {
 		snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev,
 			 mdev_ch);
-		mdev_devnod = devnod_buf;
+		aim_param = devnod_buf;
 	}
 
 	c = get_channel_by_name(mdev, mdev_ch);
 	if (IS_ERR(c))
 		return -ENODEV;
 
-	ret = link_channel_to_aim(c, aim, mdev_devnod);
+	ret = link_channel_to_aim(c, aim, aim_param);
 	if (ret)
 		return ret;
 
@@ -728,24 +761,24 @@ static ssize_t add_link_store(struct device *dev,
  * Example:
  * echo "mdev0:ep81" >remove_link
  */
-static ssize_t remove_link_store(struct device *dev,
-				 struct device_attribute *attr,
+static ssize_t remove_link_store(struct device_driver *drv,
 				 const char *buf,
 				 size_t len)
 {
 	struct most_channel *c;
-	struct most_aim *aim = to_most_aim(dev);
+	struct most_aim *aim;
 	char buffer[STRING_SIZE];
 	char *mdev;
 	char *mdev_ch;
+	char *aim_name;
 	int ret;
 	size_t max_len = min_t(size_t, len + 1, STRING_SIZE);
 
 	strlcpy(buffer, buf, max_len);
-	ret = split_string(buffer, &mdev, &mdev_ch, NULL);
+	ret = split_string(buffer, &mdev, &mdev_ch, &aim_name, NULL);
 	if (ret)
 		return ret;
-
+	aim = match_module(aim_name);
 	c = get_channel_by_name(mdev, mdev_ch);
 	if (IS_ERR(c))
 		return -ENODEV;
@@ -759,23 +792,27 @@ static ssize_t remove_link_store(struct device *dev,
 	return len;
 }
 
-static DEVICE_ATTR_RO(links);
-static DEVICE_ATTR_WO(add_link);
-static DEVICE_ATTR_WO(remove_link);
+#define DRV_ATTR(_name)  (&driver_attr_##_name.attr)
+
+static DRIVER_ATTR_RO(links);
+static DRIVER_ATTR_RO(modules);
+static DRIVER_ATTR_WO(add_link);
+static DRIVER_ATTR_WO(remove_link);
 
-static struct attribute *aim_attrs[] = {
-	DEV_ATTR(links),
-	DEV_ATTR(add_link),
-	DEV_ATTR(remove_link),
+static struct attribute *module_attrs[] = {
+	DRV_ATTR(links),
+	DRV_ATTR(modules),
+	DRV_ATTR(add_link),
+	DRV_ATTR(remove_link),
 	NULL,
 };
 
-static struct attribute_group aim_attr_group = {
-	.attrs = aim_attrs,
+static struct attribute_group module_attr_group = {
+	.attrs = module_attrs,
 };
 
-static const struct attribute_group *aim_attr_groups[] = {
-	&aim_attr_group,
+static const struct attribute_group *module_attr_groups[] = {
+	&module_attr_group,
 	NULL,
 };
 
@@ -1293,7 +1330,6 @@ int most_register_aim(struct most_aim *aim)
 	aim->dev.init_name = aim->name;
 	aim->dev.bus = &mc.bus;
 	aim->dev.parent = &mc.dev;
-	aim->dev.groups = aim_attr_groups;
 	aim->dev.release = release_aim;
 	ret = device_register(&aim->dev);
 	if (ret) {
@@ -1559,6 +1595,7 @@ static int __init most_init(void)
 	mc.bus.match = most_match,
 	mc.drv.name = "most_core",
 	mc.drv.bus = &mc.bus,
+	mc.drv.groups = module_attr_groups;
 
 	err = bus_register(&mc.bus);
 	if (err) {
-- 
2.7.4

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

* [PATCH 20/50] staging: most: core: remove struct device
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (18 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 19/50] staging: most: core: fix sysfs attribute management Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-22 13:01   ` PrasannaKumar Muralidharan
  2017-11-21 14:04 ` [PATCH 21/50] staging: most: core: rename function Christian Gromm
                   ` (31 subsequent siblings)
  51 siblings, 1 reply; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch takes out the struct device of struct most_aim, because it is
not needed.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 17 -----------------
 drivers/staging/most/core.h |  1 -
 2 files changed, 18 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 7014f6a..8f6fa9e 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -1310,32 +1310,16 @@ int most_stop_channel(struct most_interface *iface, int id,
 }
 EXPORT_SYMBOL_GPL(most_stop_channel);
 
-void release_aim(struct device *dev)
-{
-	pr_info("releasing aim %s\n", dev_name(dev));
-}
-
 /**
  * most_register_aim - registers an AIM (driver) with the core
  * @aim: instance of AIM to be registered
  */
 int most_register_aim(struct most_aim *aim)
 {
-	int ret;
-
 	if (!aim) {
 		pr_err("Bad driver\n");
 		return -EINVAL;
 	}
-	aim->dev.init_name = aim->name;
-	aim->dev.bus = &mc.bus;
-	aim->dev.parent = &mc.dev;
-	aim->dev.release = release_aim;
-	ret = device_register(&aim->dev);
-	if (ret) {
-		pr_err("registering device %s failed\n", aim->name);
-		return ret;
-	}
 	list_add_tail(&aim->list, &mc.mod_list);
 	pr_info("registered new application interfacing module %s\n", aim->name);
 	return 0;
@@ -1367,7 +1351,6 @@ int most_deregister_aim(struct most_aim *aim)
 				c->pipe1.aim = NULL;
 		}
 	}
-	device_unregister(&aim->dev);
 	list_del(&aim->list);
 	pr_info("deregistering application interfacing module %s\n", aim->name);
 	return 0;
diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h
index 0199be0..a4fb75c 100644
--- a/drivers/staging/most/core.h
+++ b/drivers/staging/most/core.h
@@ -268,7 +268,6 @@ struct most_interface {
  * @context: context pointer to be used by mostcore
  */
 struct most_aim {
-	struct device dev;
 	struct list_head list;
 	const char *name;
 	int (*probe_channel)(struct most_interface *iface, int channel_idx,
-- 
2.7.4

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

* [PATCH 21/50] staging: most: core: rename function
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (19 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 20/50] staging: most: core: remove struct device Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 22/50] staging: most: core: replace struct most_inst_obj Christian Gromm
                   ` (30 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

The core module used to have two functions to find a certain
channel. One by name and one by interface. Since no channel is
searched by its interface name anymore the by_name suffix is
rendered redundant. This patch renames the function accordingly.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 8f6fa9e..4caea38 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -634,13 +634,13 @@ static int split_string(char *buf, char **a, char **b, char **c, char **d)
 }
 
 /**
- * get_channel_by_name - get pointer to channel object
+ * get_channel - get pointer to channel object
  * @mdev: name of the device instance
  * @mdev_ch: name of the respective channel
  *
  * This retrieves the pointer to a channel object.
  */
-static struct most_channel *get_channel_by_name(char *mdev, char *mdev_ch)
+static struct most_channel *get_channel(char *mdev, char *mdev_ch)
 {
 	struct most_channel *c, *tmp;
 	struct most_inst_obj *i, *i_tmp;
@@ -740,7 +740,7 @@ static ssize_t add_link_store(struct device_driver *drv,
 		aim_param = devnod_buf;
 	}
 
-	c = get_channel_by_name(mdev, mdev_ch);
+	c = get_channel(mdev, mdev_ch);
 	if (IS_ERR(c))
 		return -ENODEV;
 
@@ -779,7 +779,7 @@ static ssize_t remove_link_store(struct device_driver *drv,
 	if (ret)
 		return ret;
 	aim = match_module(aim_name);
-	c = get_channel_by_name(mdev, mdev_ch);
+	c = get_channel(mdev, mdev_ch);
 	if (IS_ERR(c))
 		return -ENODEV;
 
-- 
2.7.4

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

* [PATCH 22/50] staging: most: core: replace struct most_inst_obj
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (20 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 21/50] staging: most: core: rename function Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 23/50] staging: most: core: put channel name in struct most_channel Christian Gromm
                   ` (29 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch introduces struct interface_private as a replacement for
the struct most_inst_obj. This structure holds private data that is
only needed by the core module and will be accessed by a pointer from
within the most_interface structure. As a result of this replacement
the bus helper functions can be used to search for devices.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 200 +++++++++++++++++++++-----------------------
 drivers/staging/most/core.h |   2 +
 2 files changed, 99 insertions(+), 103 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 4caea38..87178a8 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -62,7 +62,6 @@ struct most_channel {
 	struct mutex nq_mutex; /* nq thread synchronization */
 	int is_starving;
 	struct most_interface *iface;
-	struct most_inst_obj *inst;
 	struct most_channel_config cfg;
 	bool keep_mbo;
 	bool enqueue_halt;
@@ -79,12 +78,11 @@ struct most_channel {
 
 #define to_channel(d) container_of(d, struct most_channel, dev)
 
-struct most_inst_obj {
+struct interface_private {
 	int dev_id;
-	struct most_interface *iface;
-	struct list_head channel_list;
+	char name[STRING_SIZE];
 	struct most_channel *channel[MAX_CHANNELS];
-	struct list_head list;
+	struct list_head channel_list;
 };
 
 static const struct {
@@ -478,9 +476,6 @@ static const struct attribute_group *channel_attr_groups[] = {
 /*		     ___	       ___
  *		     ___I N S T A N C E___
  */
-
-static struct list_head instance_list;
-
 static ssize_t description_show(struct device *dev,
 				struct device_attribute *attr,
 				char *buf)
@@ -551,33 +546,38 @@ static struct most_aim *match_module(char *name)
 	return NULL;
 }
 
-static ssize_t links_show(struct device_driver *drv, char *buf)
+int print_links(struct device *dev, void *data)
 {
-	struct most_channel *c;
-	struct most_inst_obj *i;
 	int offs = 0;
+	char *buf = data;
+	struct most_channel *c;
+	struct most_interface *iface = to_most_interface(dev);
 
-	list_for_each_entry(i, &instance_list, list) {
-		list_for_each_entry(c, &i->channel_list, list) {
-			if (c->pipe0.aim) {
-				offs += snprintf(buf + offs,
-						 PAGE_SIZE - offs,
-						 "%s:%s:%s\n",
-						 c->pipe0.aim->name,
-						 dev_name(&i->iface->dev),
-						 dev_name(&c->dev));
-			}
-			if (c->pipe1.aim) {
-				offs += snprintf(buf + offs,
-						 PAGE_SIZE - offs,
-						 "%s:%s:%s\n",
-						 c->pipe1.aim->name,
-						 dev_name(&i->iface->dev),
-						 dev_name(&c->dev));
-			}
+	list_for_each_entry(c, &iface->p->channel_list, list) {
+		if (c->pipe0.aim) {
+			offs += snprintf(buf + offs,
+					 PAGE_SIZE - offs,
+					 "%s:%s:%s\n",
+					 c->pipe0.aim->name,
+					 dev_name(&iface->dev),
+					 dev_name(&c->dev));
+		}
+		if (c->pipe1.aim) {
+			offs += snprintf(buf + offs,
+					 PAGE_SIZE - offs,
+					 "%s:%s:%s\n",
+					 c->pipe1.aim->name,
+					 dev_name(&iface->dev),
+					 dev_name(&c->dev));
 		}
 	}
-	return offs;
+	return 0;
+}
+
+static ssize_t links_show(struct device_driver *drv, char *buf)
+{
+	bus_for_each_dev(&mc.bus, NULL, buf, print_links);
+	return strlen(buf);
 }
 
 static ssize_t modules_show(struct device_driver *drv, char *buf)
@@ -633,6 +633,13 @@ static int split_string(char *buf, char **a, char **b, char **c, char **d)
 	return 0;
 }
 
+static int match_bus_dev(struct device *dev, void *data)
+{
+	char *mdev_name = data;
+
+	return !strcmp(dev_name(dev), mdev_name);
+}
+
 /**
  * get_channel - get pointer to channel object
  * @mdev: name of the device instance
@@ -642,28 +649,19 @@ static int split_string(char *buf, char **a, char **b, char **c, char **d)
  */
 static struct most_channel *get_channel(char *mdev, char *mdev_ch)
 {
+	struct device *dev = NULL;
+	struct most_interface *iface;
 	struct most_channel *c, *tmp;
-	struct most_inst_obj *i, *i_tmp;
-	int found = 0;
 
-	list_for_each_entry_safe(i, i_tmp, &instance_list, list) {
-		if (!strcmp(dev_name(&i->iface->dev), mdev)) {
-			found++;
-			break;
-		}
-	}
-	if (unlikely(!found))
-		return ERR_PTR(-EIO);
-
-	list_for_each_entry_safe(c, tmp, &i->channel_list, list) {
-		if (!strcmp(dev_name(&c->dev), mdev_ch)) {
-			found++;
-			break;
-		}
+	dev = bus_find_device(&mc.bus, NULL, mdev, match_bus_dev);
+	if (!dev)
+		return NULL;
+	iface = to_most_interface(dev);
+	list_for_each_entry_safe(c, tmp, &iface->p->channel_list, list) {
+		if (!strcmp(dev_name(&c->dev), mdev_ch))
+			return c;
 	}
-	if (unlikely(found < 2))
-		return ERR_PTR(-EIO);
-	return c;
+	return NULL;
 }
 
 static
@@ -741,7 +739,7 @@ static ssize_t add_link_store(struct device_driver *drv,
 	}
 
 	c = get_channel(mdev, mdev_ch);
-	if (IS_ERR(c))
+	if (!c)
 		return -ENODEV;
 
 	ret = link_channel_to_aim(c, aim, aim_param);
@@ -780,7 +778,7 @@ static ssize_t remove_link_store(struct device_driver *drv,
 		return ret;
 	aim = match_module(aim_name);
 	c = get_channel(mdev, mdev_ch);
-	if (IS_ERR(c))
+	if (!c)
 		return -ENODEV;
 
 	if (aim->disconnect_channel(c->iface, c->channel_id))
@@ -1048,8 +1046,7 @@ static void most_write_completion(struct mbo *mbo)
 
 int channel_has_mbo(struct most_interface *iface, int id, struct most_aim *aim)
 {
-	struct most_inst_obj *inst = iface->priv;
-	struct most_channel *c = inst->channel[id];
+	struct most_channel *c = iface->p->channel[id];
 	unsigned long flags;
 	int empty;
 
@@ -1081,11 +1078,10 @@ struct mbo *most_get_mbo(struct most_interface *iface, int id,
 {
 	struct mbo *mbo;
 	struct most_channel *c;
-	struct most_inst_obj *inst = iface->priv;
 	unsigned long flags;
 	int *num_buffers_ptr;
 
-	c = inst->channel[id];
+	c = iface->p->channel[id];
 	if (unlikely(!c))
 		return NULL;
 
@@ -1187,8 +1183,7 @@ int most_start_channel(struct most_interface *iface, int id,
 {
 	int num_buffer;
 	int ret;
-	struct most_inst_obj *inst = iface->priv;
-	struct most_channel *c = inst->channel[id];
+	struct most_channel *c = iface->p->channel[id];
 
 	if (unlikely(!c))
 		return -EINVAL;
@@ -1256,15 +1251,13 @@ EXPORT_SYMBOL_GPL(most_start_channel);
 int most_stop_channel(struct most_interface *iface, int id,
 		      struct most_aim *aim)
 {
-	struct most_inst_obj *inst;
 	struct most_channel *c;
 
 	if (unlikely((!iface) || (id >= iface->num_channels) || (id < 0))) {
 		pr_err("Bad interface or index out of range\n");
 		return -EINVAL;
 	}
-	inst = iface->priv;
-	c = inst->channel[id];
+	c = iface->p->channel[id];
 	if (unlikely(!c))
 		return -EINVAL;
 
@@ -1326,33 +1319,38 @@ int most_register_aim(struct most_aim *aim)
 }
 EXPORT_SYMBOL_GPL(most_register_aim);
 
+static int disconnect_channels(struct device *dev, void *data)
+{
+	struct most_interface *iface;
+	struct most_channel *c, *tmp;
+	struct most_aim *aim = data;
+
+	iface = to_most_interface(dev);
+	list_for_each_entry_safe(c, tmp, &iface->p->channel_list, list) {
+		if (c->pipe0.aim == aim || c->pipe1.aim == aim)
+			aim->disconnect_channel(c->iface, c->channel_id);
+		if (c->pipe0.aim == aim)
+			c->pipe0.aim = NULL;
+		if (c->pipe1.aim == aim)
+			c->pipe1.aim = NULL;
+	}
+	return 0;
+}
+
 /**
  * most_deregister_aim - deregisters an AIM (driver) with the core
  * @aim: AIM to be removed
  */
 int most_deregister_aim(struct most_aim *aim)
 {
-	struct most_channel *c, *tmp;
-	struct most_inst_obj *i, *i_tmp;
-
 	if (!aim) {
 		pr_err("Bad driver\n");
 		return -EINVAL;
 	}
 
-	list_for_each_entry_safe(i, i_tmp, &instance_list, list) {
-		list_for_each_entry_safe(c, tmp, &i->channel_list, list) {
-			if (c->pipe0.aim == aim || c->pipe1.aim == aim)
-				aim->disconnect_channel(
-					c->iface, c->channel_id);
-			if (c->pipe0.aim == aim)
-				c->pipe0.aim = NULL;
-			if (c->pipe1.aim == aim)
-				c->pipe1.aim = NULL;
-		}
-	}
+	bus_for_each_dev(&mc.bus, NULL, aim, disconnect_channels);
 	list_del(&aim->list);
-	pr_info("deregistering application interfacing module %s\n", aim->name);
+	pr_info("deregistering module %s\n", aim->name);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(most_deregister_aim);
@@ -1378,10 +1376,8 @@ int most_register_interface(struct most_interface *iface)
 {
 	unsigned int i;
 	int id;
-	char name[STRING_SIZE];
 	char channel_name[STRING_SIZE];
 	struct most_channel *c;
-	struct most_inst_obj *inst;
 
 	if (!iface || !iface->enqueue || !iface->configure ||
 	    !iface->poison_channel || (iface->num_channels > MAX_CHANNELS)) {
@@ -1395,27 +1391,24 @@ int most_register_interface(struct most_interface *iface)
 		return id;
 	}
 
-	inst = kzalloc(sizeof(*inst), GFP_KERNEL);
-	if (!inst) {
+	iface->p = kzalloc(sizeof(*iface->p), GFP_KERNEL);
+	if (!iface->p) {
 		pr_info("Failed to allocate interface instance\n");
 		ida_simple_remove(&mdev_id, id);
 		return -ENOMEM;
 	}
 
-	iface->priv = inst;
-	INIT_LIST_HEAD(&inst->channel_list);
-	inst->iface = iface;
-	inst->dev_id = id;
-	list_add_tail(&inst->list, &instance_list);
-	snprintf(name, STRING_SIZE, "mdev%d", id);
-	iface->dev.init_name = name;
+	INIT_LIST_HEAD(&iface->p->channel_list);
+	iface->p->dev_id = id;
+	snprintf(iface->p->name, STRING_SIZE, "mdev%d", id);
+	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)) {
 		pr_err("registering iface->dev failed\n");
-		kfree(inst);
+		kfree(iface->p);
 		ida_simple_remove(&mdev_id, id);
 		return -ENOMEM;
 	}
@@ -1428,7 +1421,6 @@ int most_register_interface(struct most_interface *iface)
 		else
 			snprintf(channel_name, STRING_SIZE, "%s", name_suffix);
 
-		/* this increments the reference count of this instance */
 		c = kzalloc(sizeof(*c), GFP_KERNEL);
 		if (!c)
 			goto free_instance;
@@ -1438,12 +1430,11 @@ int most_register_interface(struct most_interface *iface)
 		c->dev.release = release_channel;
 		if (device_register(&c->dev)) {
 			pr_err("registering c->dev failed\n");
-			goto free_instance;
+			goto free_instance_nodev;
 		}
-		inst->channel[i] = c;
+		iface->p->channel[i] = c;
 		c->is_starving = 0;
 		c->iface = iface;
-		c->inst = inst;
 		c->channel_id = i;
 		c->keep_mbo = false;
 		c->enqueue_halt = false;
@@ -1462,14 +1453,22 @@ int most_register_interface(struct most_interface *iface)
 		atomic_set(&c->mbo_ref, 0);
 		mutex_init(&c->start_mutex);
 		mutex_init(&c->nq_mutex);
-		list_add_tail(&c->list, &inst->channel_list);
+		list_add_tail(&c->list, &iface->p->channel_list);
 	}
 	pr_info("registered new MOST device mdev%d (%s)\n",
 		id, iface->description);
 	return 0;
 
+free_instance_nodev:
+	kfree(c);
+
 free_instance:
-	pr_info("Failed allocate channel(s)\n");
+	while (i > 0) {
+		c = iface->p->channel[--i];
+		device_unregister(&c->dev);
+		kfree(c);
+	}
+	kfree(iface->p);
 	device_unregister(&iface->dev);
 	ida_simple_remove(&mdev_id, id);
 	return -ENOMEM;
@@ -1487,12 +1486,10 @@ void most_deregister_interface(struct most_interface *iface)
 {
 	int i;
 	struct most_channel *c;
-	struct most_inst_obj *inst;
 
 	pr_info("deregistering MOST device %s (%s)\n", dev_name(&iface->dev), iface->description);
-	inst = iface->priv;
 	for (i = 0; i < iface->num_channels; i++) {
-		c = inst->channel[i];
+		c = iface->p->channel[i];
 		if (c->pipe0.aim)
 			c->pipe0.aim->disconnect_channel(c->iface,
 							c->channel_id);
@@ -1506,8 +1503,8 @@ void most_deregister_interface(struct most_interface *iface)
 		kfree(c);
 	}
 
-	ida_simple_remove(&mdev_id, inst->dev_id);
-	kfree(inst);
+	ida_simple_remove(&mdev_id, iface->p->dev_id);
+	kfree(iface->p);
 	device_unregister(&iface->dev);
 }
 EXPORT_SYMBOL_GPL(most_deregister_interface);
@@ -1524,8 +1521,7 @@ EXPORT_SYMBOL_GPL(most_deregister_interface);
  */
 void most_stop_enqueue(struct most_interface *iface, int id)
 {
-	struct most_inst_obj *inst = iface->priv;
-	struct most_channel *c = inst->channel[id];
+	struct most_channel *c = iface->p->channel[id];
 
 	if (!c)
 		return;
@@ -1546,8 +1542,7 @@ EXPORT_SYMBOL_GPL(most_stop_enqueue);
  */
 void most_resume_enqueue(struct most_interface *iface, int id)
 {
-	struct most_inst_obj *inst = iface->priv;
-	struct most_channel *c = inst->channel[id];
+	struct most_channel *c = iface->p->channel[id];
 
 	if (!c)
 		return;
@@ -1570,7 +1565,6 @@ static int __init most_init(void)
 	int err;
 
 	pr_info("init()\n");
-	INIT_LIST_HEAD(&instance_list);
 	INIT_LIST_HEAD(&mc.mod_list);
 	ida_init(&mdev_id);
 
diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h
index a4fb75c..fe0ad62 100644
--- a/drivers/staging/most/core.h
+++ b/drivers/staging/most/core.h
@@ -26,6 +26,7 @@
 #include <linux/device.h>
 
 struct module;
+struct interface_private;
 
 /**
  * Interface type
@@ -254,6 +255,7 @@ struct most_interface {
 						   unsigned char link_stat,
 						   unsigned char *mac_addr));
 	void *priv;
+	struct interface_private *p;
 };
 
 #define to_most_interface(d) container_of(d, struct most_interface, dev)
-- 
2.7.4

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

* [PATCH 23/50] staging: most: core: put channel name in struct most_channel
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (21 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 22/50] staging: most: core: replace struct most_inst_obj Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 24/50] staging: most: core: remove context pointer Christian Gromm
                   ` (28 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch stores a channel's name inside the most_channel structure. It
is needed to have the channel attributes tied together.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 87178a8..f47d581 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -57,6 +57,7 @@ struct most_channel {
 	atomic_t mbo_ref;
 	atomic_t mbo_nq_level;
 	u16 channel_id;
+	char name[STRING_SIZE];
 	bool is_poisoned;
 	struct mutex start_mutex;
 	struct mutex nq_mutex; /* nq thread synchronization */
@@ -1376,7 +1377,6 @@ int most_register_interface(struct most_interface *iface)
 {
 	unsigned int i;
 	int id;
-	char channel_name[STRING_SIZE];
 	struct most_channel *c;
 
 	if (!iface || !iface->enqueue || !iface->configure ||
@@ -1416,15 +1416,14 @@ int most_register_interface(struct most_interface *iface)
 	for (i = 0; i < iface->num_channels; i++) {
 		const char *name_suffix = iface->channel_vector[i].name_suffix;
 
-		if (!name_suffix)
-			snprintf(channel_name, STRING_SIZE, "ch%d", i);
-		else
-			snprintf(channel_name, STRING_SIZE, "%s", name_suffix);
-
 		c = kzalloc(sizeof(*c), GFP_KERNEL);
 		if (!c)
 			goto free_instance;
-		c->dev.init_name = channel_name;
+		if (!name_suffix)
+			snprintf(c->name, STRING_SIZE, "ch%d", i);
+		else
+			snprintf(c->name, STRING_SIZE, "%s", name_suffix);
+		c->dev.init_name = c->name;
 		c->dev.parent = &iface->dev;
 		c->dev.groups = channel_attr_groups;
 		c->dev.release = release_channel;
-- 
2.7.4

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

* [PATCH 24/50] staging: most: core: remove context pointer
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (22 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 23/50] staging: most: core: put channel name in struct most_channel Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:04 ` [PATCH 25/50] staging: most: usb: remove pointer initialization Christian Gromm
                   ` (27 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch removes the unused context pointer that was meant to provide the
opportunity to store context information.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h
index fe0ad62..fd8a703 100644
--- a/drivers/staging/most/core.h
+++ b/drivers/staging/most/core.h
@@ -278,7 +278,6 @@ struct most_aim {
 				  int channel_idx);
 	int (*rx_completion)(struct mbo *mbo);
 	int (*tx_completion)(struct most_interface *iface, int channel_idx);
-	void *context;
 };
 
 #define to_most_aim(d) container_of(d, struct most_aim, dev)
-- 
2.7.4

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

* [PATCH 25/50] staging: most: usb: remove pointer initialization
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (23 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 24/50] staging: most: core: remove context pointer Christian Gromm
@ 2017-11-21 14:04 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 26/50] staging: most: rename struct most_aim Christian Gromm
                   ` (26 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:04 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch removes the initialization of the priv pointer of the
most_interface structure.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/usb/usb.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index da2fc54..acd0a36 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -1043,8 +1043,6 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
 		goto exit_free1;
 
 	mdev->iface.channel_vector = mdev->cap;
-	mdev->iface.priv = NULL;
-
 	mdev->ep_address =
 		kcalloc(num_endpoints, sizeof(*mdev->ep_address), GFP_KERNEL);
 	if (!mdev->ep_address)
-- 
2.7.4

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

* [PATCH 26/50] staging: most: rename struct most_aim
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (24 preceding siblings ...)
  2017-11-21 14:04 ` [PATCH 25/50] staging: most: usb: remove pointer initialization Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-22 13:01   ` PrasannaKumar Muralidharan
  2017-11-21 14:05 ` [PATCH 27/50] staging: most: rename functions to register a driver with most_core Christian Gromm
                   ` (25 subsequent siblings)
  51 siblings, 1 reply; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

The designator of a module that proivdes means to interface userspace is
called an AIM. Since this name seems to be unappropiate, this kind of
moduels are going to be referred to as componetns. This is done because
such modules function as components to enhance the core with new features.
This patch renames the struct most_aim to core_component.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/cdev/cdev.c   |  4 ++--
 drivers/staging/most/core.c        | 30 +++++++++++++++---------------
 drivers/staging/most/core.h        | 16 +++++++---------
 drivers/staging/most/net/net.c     |  4 ++--
 drivers/staging/most/sound/sound.c |  6 +++---
 drivers/staging/most/video/video.c |  4 ++--
 6 files changed, 31 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c
index c6baa9c..e1290b8 100644
--- a/drivers/staging/most/cdev/cdev.c
+++ b/drivers/staging/most/cdev/cdev.c
@@ -28,7 +28,7 @@ static dev_t aim_devno;
 static struct class *aim_class;
 static struct ida minor_id;
 static unsigned int major;
-static struct most_aim cdev_aim;
+static struct core_component cdev_aim;
 
 struct aim_channel {
 	wait_queue_head_t wq;
@@ -495,7 +495,7 @@ static int aim_probe(struct most_interface *iface, int channel_id,
 	return retval;
 }
 
-static struct most_aim cdev_aim = {
+static struct core_component cdev_aim = {
 	.name = "cdev",
 	.probe_channel = aim_probe,
 	.disconnect_channel = aim_disconnect_channel,
diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index f47d581..fa1ed89d6 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -46,7 +46,7 @@ static struct mostcore {
 #define to_driver(d) container_of(d, struct mostcore, drv);
 
 struct pipe {
-	struct most_aim *aim;
+	struct core_component *aim;
 	int refs;
 	int num_buffers;
 };
@@ -536,9 +536,9 @@ static const struct attribute_group *interface_attr_groups[] = {
 /*		     ___     ___
  *		     ___A I M___
  */
-static struct most_aim *match_module(char *name)
+static struct core_component *match_module(char *name)
 {
-	struct most_aim *aim;
+	struct core_component *aim;
 
 	list_for_each_entry(aim, &mc.mod_list, list) {
 		if (!strcmp(aim->name, name))
@@ -583,7 +583,7 @@ static ssize_t links_show(struct device_driver *drv, char *buf)
 
 static ssize_t modules_show(struct device_driver *drv, char *buf)
 {
-	struct most_aim *aim;
+	struct core_component *aim;
 	int offs = 0;
 
 	list_for_each_entry(aim, &mc.mod_list, list) {
@@ -666,11 +666,11 @@ static struct most_channel *get_channel(char *mdev, char *mdev_ch)
 }
 
 static
-inline int link_channel_to_aim(struct most_channel *c, struct most_aim *aim,
+inline int link_channel_to_aim(struct most_channel *c, struct core_component *aim,
 			       char *aim_param)
 {
 	int ret;
-	struct most_aim **aim_ptr;
+	struct core_component **aim_ptr;
 
 	if (!c->pipe0.aim)
 		aim_ptr = &c->pipe0.aim;
@@ -717,7 +717,7 @@ static ssize_t add_link_store(struct device_driver *drv,
 			      size_t len)
 {
 	struct most_channel *c;
-	struct most_aim *aim;
+	struct core_component *aim;
 	char buffer[STRING_SIZE];
 	char *mdev;
 	char *mdev_ch;
@@ -765,7 +765,7 @@ static ssize_t remove_link_store(struct device_driver *drv,
 				 size_t len)
 {
 	struct most_channel *c;
-	struct most_aim *aim;
+	struct core_component *aim;
 	char buffer[STRING_SIZE];
 	char *mdev;
 	char *mdev_ch;
@@ -1045,7 +1045,7 @@ static void most_write_completion(struct mbo *mbo)
 		arm_mbo(mbo);
 }
 
-int channel_has_mbo(struct most_interface *iface, int id, struct most_aim *aim)
+int channel_has_mbo(struct most_interface *iface, int id, struct core_component *aim)
 {
 	struct most_channel *c = iface->p->channel[id];
 	unsigned long flags;
@@ -1075,7 +1075,7 @@ EXPORT_SYMBOL_GPL(channel_has_mbo);
  * Returns a pointer to MBO on success or NULL otherwise.
  */
 struct mbo *most_get_mbo(struct most_interface *iface, int id,
-			 struct most_aim *aim)
+			 struct core_component *aim)
 {
 	struct mbo *mbo;
 	struct most_channel *c;
@@ -1180,7 +1180,7 @@ static void most_read_completion(struct mbo *mbo)
  * Returns 0 on success or error code otherwise.
  */
 int most_start_channel(struct most_interface *iface, int id,
-		       struct most_aim *aim)
+		       struct core_component *aim)
 {
 	int num_buffer;
 	int ret;
@@ -1250,7 +1250,7 @@ EXPORT_SYMBOL_GPL(most_start_channel);
  * @id: channel ID
  */
 int most_stop_channel(struct most_interface *iface, int id,
-		      struct most_aim *aim)
+		      struct core_component *aim)
 {
 	struct most_channel *c;
 
@@ -1308,7 +1308,7 @@ EXPORT_SYMBOL_GPL(most_stop_channel);
  * most_register_aim - registers an AIM (driver) with the core
  * @aim: instance of AIM to be registered
  */
-int most_register_aim(struct most_aim *aim)
+int most_register_aim(struct core_component *aim)
 {
 	if (!aim) {
 		pr_err("Bad driver\n");
@@ -1324,7 +1324,7 @@ static int disconnect_channels(struct device *dev, void *data)
 {
 	struct most_interface *iface;
 	struct most_channel *c, *tmp;
-	struct most_aim *aim = data;
+	struct core_component *aim = data;
 
 	iface = to_most_interface(dev);
 	list_for_each_entry_safe(c, tmp, &iface->p->channel_list, list) {
@@ -1342,7 +1342,7 @@ static int disconnect_channels(struct device *dev, void *data)
  * most_deregister_aim - deregisters an AIM (driver) with the core
  * @aim: AIM to be removed
  */
-int most_deregister_aim(struct most_aim *aim)
+int most_deregister_aim(struct core_component *aim)
 {
 	if (!aim) {
 		pr_err("Bad driver\n");
diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h
index fd8a703..cfd5884 100644
--- a/drivers/staging/most/core.h
+++ b/drivers/staging/most/core.h
@@ -269,7 +269,7 @@ struct most_interface {
  * @tx_completion: completion handler for transmitted packets
  * @context: context pointer to be used by mostcore
  */
-struct most_aim {
+struct core_component {
 	struct list_head list;
 	const char *name;
 	int (*probe_channel)(struct most_interface *iface, int channel_idx,
@@ -280,8 +280,6 @@ struct most_aim {
 	int (*tx_completion)(struct most_interface *iface, int channel_idx);
 };
 
-#define to_most_aim(d) container_of(d, struct most_aim, dev)
-
 /**
  * most_register_interface - Registers instance of the interface.
  * @iface: Pointer to the interface instance description.
@@ -316,16 +314,16 @@ void most_stop_enqueue(struct most_interface *iface, int channel_idx);
  * in wait fifo.
  */
 void most_resume_enqueue(struct most_interface *iface, int channel_idx);
-int most_register_aim(struct most_aim *aim);
-int most_deregister_aim(struct most_aim *aim);
+int most_register_aim(struct core_component *comp);
+int most_deregister_aim(struct core_component *comp);
 struct mbo *most_get_mbo(struct most_interface *iface, int channel_idx,
-			 struct most_aim *);
+			 struct core_component *comp);
 void most_put_mbo(struct mbo *mbo);
 int channel_has_mbo(struct most_interface *iface, int channel_idx,
-		    struct most_aim *aim);
+		    struct core_component *comp);
 int most_start_channel(struct most_interface *iface, int channel_idx,
-		       struct most_aim *);
+		       struct core_component *comp);
 int most_stop_channel(struct most_interface *iface, int channel_idx,
-		      struct most_aim *);
+		      struct core_component *comp);
 
 #endif /* MOST_CORE_H_ */
diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c
index 06501ff..b418436 100644
--- a/drivers/staging/most/net/net.c
+++ b/drivers/staging/most/net/net.c
@@ -74,7 +74,7 @@ struct net_dev_context {
 static struct list_head net_devices = LIST_HEAD_INIT(net_devices);
 static struct mutex probe_disc_mt; /* ch->linked = true, most_nd_open */
 static struct spinlock list_lock; /* list_head, ch->linked = false, dev_hold */
-static struct most_aim aim;
+static struct core_component aim;
 
 static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo)
 {
@@ -500,7 +500,7 @@ static int aim_rx_data(struct mbo *mbo)
 	return ret;
 }
 
-static struct most_aim aim = {
+static struct core_component aim = {
 	.name = "net",
 	.probe_channel = aim_probe_channel,
 	.disconnect_channel = aim_disconnect_channel,
diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c
index d8ce059..2c13344 100644
--- a/drivers/staging/most/sound/sound.c
+++ b/drivers/staging/most/sound/sound.c
@@ -27,7 +27,7 @@
 #define DRIVER_NAME "sound"
 
 static struct list_head dev_list;
-static struct most_aim audio_aim;
+static struct core_component audio_aim;
 
 /**
  * struct channel - private structure to keep channel specific data
@@ -723,9 +723,9 @@ static int audio_tx_completion(struct most_interface *iface, int channel_id)
 }
 
 /**
- * Initialization of the struct most_aim
+ * Initialization of the struct core_component
  */
-static struct most_aim audio_aim = {
+static struct core_component audio_aim = {
 	.name = DRIVER_NAME,
 	.probe_channel = audio_probe_channel,
 	.disconnect_channel = audio_disconnect_channel,
diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
index 2c27416..1a5af3c 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -31,7 +31,7 @@
 
 #define V4L2_AIM_MAX_INPUT  1
 
-static struct most_aim aim_info;
+static struct core_component aim_info;
 
 struct most_video_dev {
 	struct most_interface *iface;
@@ -568,7 +568,7 @@ static int aim_disconnect_channel(struct most_interface *iface,
 	return 0;
 }
 
-static struct most_aim aim_info = {
+static struct core_component aim_info = {
 	.name = "v4l",
 	.probe_channel = aim_probe_channel,
 	.disconnect_channel = aim_disconnect_channel,
-- 
2.7.4

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

* [PATCH 27/50] staging: most: rename functions to register a driver with most_core
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (25 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 26/50] staging: most: rename struct most_aim Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 28/50] staging: most: core: rename mod_list Christian Gromm
                   ` (24 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the functions to register and deregister a component
module with the core. It is needed because the modules that interface the
userspace are referred to as components.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/cdev/cdev.c   |  4 ++--
 drivers/staging/most/core.c        | 13 +++++++------
 drivers/staging/most/core.h        |  4 ++--
 drivers/staging/most/net/net.c     |  4 ++--
 drivers/staging/most/sound/sound.c |  4 ++--
 drivers/staging/most/video/video.c |  6 +++---
 6 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c
index e1290b8..5f8f003 100644
--- a/drivers/staging/most/cdev/cdev.c
+++ b/drivers/staging/most/cdev/cdev.c
@@ -524,7 +524,7 @@ static int __init mod_init(void)
 		err = PTR_ERR(aim_class);
 		goto free_cdev;
 	}
-	err = most_register_aim(&cdev_aim);
+	err = most_register_component(&cdev_aim);
 	if (err)
 		goto dest_class;
 	return 0;
@@ -544,7 +544,7 @@ static void __exit mod_exit(void)
 
 	pr_info("exit module\n");
 
-	most_deregister_aim(&cdev_aim);
+	most_deregister_component(&cdev_aim);
 
 	list_for_each_entry_safe(c, tmp, &channel_list, list) {
 		destroy_cdev(c);
diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index fa1ed89d6..db453f2 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -75,6 +75,7 @@ struct most_channel {
 	struct list_head trash_fifo;
 	struct task_struct *hdm_enqueue_task;
 	wait_queue_head_t hdm_fifo_wq;
+
 };
 
 #define to_channel(d) container_of(d, struct most_channel, dev)
@@ -1305,10 +1306,10 @@ int most_stop_channel(struct most_interface *iface, int id,
 EXPORT_SYMBOL_GPL(most_stop_channel);
 
 /**
- * most_register_aim - registers an AIM (driver) with the core
+ * most_register_component - registers an AIM (driver) with the core
  * @aim: instance of AIM to be registered
  */
-int most_register_aim(struct core_component *aim)
+int most_register_component(struct core_component *aim)
 {
 	if (!aim) {
 		pr_err("Bad driver\n");
@@ -1318,7 +1319,7 @@ int most_register_aim(struct core_component *aim)
 	pr_info("registered new application interfacing module %s\n", aim->name);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(most_register_aim);
+EXPORT_SYMBOL_GPL(most_register_component);
 
 static int disconnect_channels(struct device *dev, void *data)
 {
@@ -1339,10 +1340,10 @@ static int disconnect_channels(struct device *dev, void *data)
 }
 
 /**
- * most_deregister_aim - deregisters an AIM (driver) with the core
+ * most_deregister_component - deregisters an AIM (driver) with the core
  * @aim: AIM to be removed
  */
-int most_deregister_aim(struct core_component *aim)
+int most_deregister_component(struct core_component *aim)
 {
 	if (!aim) {
 		pr_err("Bad driver\n");
@@ -1354,7 +1355,7 @@ int most_deregister_aim(struct core_component *aim)
 	pr_info("deregistering module %s\n", aim->name);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(most_deregister_aim);
+EXPORT_SYMBOL_GPL(most_deregister_component);
 
 static void release_interface(struct device *dev)
 {
diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h
index cfd5884..3c2975b 100644
--- a/drivers/staging/most/core.h
+++ b/drivers/staging/most/core.h
@@ -314,8 +314,8 @@ void most_stop_enqueue(struct most_interface *iface, int channel_idx);
  * in wait fifo.
  */
 void most_resume_enqueue(struct most_interface *iface, int channel_idx);
-int most_register_aim(struct core_component *comp);
-int most_deregister_aim(struct core_component *comp);
+int most_register_component(struct core_component *comp);
+int most_deregister_component(struct core_component *comp);
 struct mbo *most_get_mbo(struct most_interface *iface, int channel_idx,
 			 struct core_component *comp);
 void most_put_mbo(struct mbo *mbo);
diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c
index b418436..a7c7c58 100644
--- a/drivers/staging/most/net/net.c
+++ b/drivers/staging/most/net/net.c
@@ -512,12 +512,12 @@ static int __init most_net_init(void)
 {
 	spin_lock_init(&list_lock);
 	mutex_init(&probe_disc_mt);
-	return most_register_aim(&aim);
+	return most_register_component(&aim);
 }
 
 static void __exit most_net_exit(void)
 {
-	most_deregister_aim(&aim);
+	most_deregister_component(&aim);
 }
 
 /**
diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c
index 2c13344..85bb024 100644
--- a/drivers/staging/most/sound/sound.c
+++ b/drivers/staging/most/sound/sound.c
@@ -739,7 +739,7 @@ static int __init audio_init(void)
 
 	INIT_LIST_HEAD(&dev_list);
 
-	return most_register_aim(&audio_aim);
+	return most_register_component(&audio_aim);
 }
 
 static void __exit audio_exit(void)
@@ -753,7 +753,7 @@ static void __exit audio_exit(void)
 		snd_card_free(channel->card);
 	}
 
-	most_deregister_aim(&audio_aim);
+	most_deregister_component(&audio_aim);
 }
 
 module_init(audio_init);
diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
index 1a5af3c..34ffdab 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -578,7 +578,7 @@ static struct core_component aim_info = {
 static int __init aim_init(void)
 {
 	spin_lock_init(&list_lock);
-	return most_register_aim(&aim_info);
+	return most_register_component(&aim_info);
 }
 
 static void __exit aim_exit(void)
@@ -587,7 +587,7 @@ static void __exit aim_exit(void)
 
 	/*
 	 * As the mostcore currently doesn't call disconnect_channel()
-	 * for linked channels while we call most_deregister_aim()
+	 * for linked channels while we call most_deregister_component()
 	 * we simulate this call here.
 	 * This must be fixed in core.
 	 */
@@ -603,7 +603,7 @@ static void __exit aim_exit(void)
 	}
 	spin_unlock_irq(&list_lock);
 
-	most_deregister_aim(&aim_info);
+	most_deregister_component(&aim_info);
 	BUG_ON(!list_empty(&video_devices));
 }
 
-- 
2.7.4

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

* [PATCH 28/50] staging: most: core: rename mod_list
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (26 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 27/50] staging: most: rename functions to register a driver with most_core Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 29/50] staging: most: core: rename aim variables Christian Gromm
                   ` (23 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the variable mod_list to comp_list.  It is needed
because modules that interface userspace are referred to as components.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index db453f2..42f35ed 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -40,7 +40,7 @@ static struct mostcore {
 	struct device_driver drv;
 	struct bus_type bus;
 	struct class *class;
-	struct list_head mod_list;
+	struct list_head comp_list;
 } mc;
 
 #define to_driver(d) container_of(d, struct mostcore, drv);
@@ -541,7 +541,7 @@ static struct core_component *match_module(char *name)
 {
 	struct core_component *aim;
 
-	list_for_each_entry(aim, &mc.mod_list, list) {
+	list_for_each_entry(aim, &mc.comp_list, list) {
 		if (!strcmp(aim->name, name))
 			return aim;
 	}
@@ -587,7 +587,7 @@ static ssize_t modules_show(struct device_driver *drv, char *buf)
 	struct core_component *aim;
 	int offs = 0;
 
-	list_for_each_entry(aim, &mc.mod_list, list) {
+	list_for_each_entry(aim, &mc.comp_list, list) {
 		offs += snprintf(buf + offs, PAGE_SIZE - offs, "%s\n",
 				 aim->name);
 	}
@@ -1315,7 +1315,7 @@ int most_register_component(struct core_component *aim)
 		pr_err("Bad driver\n");
 		return -EINVAL;
 	}
-	list_add_tail(&aim->list, &mc.mod_list);
+	list_add_tail(&aim->list, &mc.comp_list);
 	pr_info("registered new application interfacing module %s\n", aim->name);
 	return 0;
 }
@@ -1565,7 +1565,7 @@ static int __init most_init(void)
 	int err;
 
 	pr_info("init()\n");
-	INIT_LIST_HEAD(&mc.mod_list);
+	INIT_LIST_HEAD(&mc.comp_list);
 	ida_init(&mdev_id);
 
 	mc.bus.name = "most",
-- 
2.7.4

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

* [PATCH 29/50] staging: most: core: rename aim variables
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (27 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 28/50] staging: most: core: rename mod_list Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 30/50] staging: most: core: rename function link_channel_to_aim Christian Gromm
                   ` (22 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch replaces the 'aim' substrings of variable names with 'comp'.
It is needed because of the renaming of AIM modules to components.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 172 ++++++++++++++++++++++----------------------
 1 file changed, 87 insertions(+), 85 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 42f35ed..c80fb9b 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -46,7 +46,7 @@ static struct mostcore {
 #define to_driver(d) container_of(d, struct mostcore, drv);
 
 struct pipe {
-	struct core_component *aim;
+	struct core_component *comp;
 	int refs;
 	int num_buffers;
 };
@@ -539,11 +539,11 @@ static const struct attribute_group *interface_attr_groups[] = {
  */
 static struct core_component *match_module(char *name)
 {
-	struct core_component *aim;
+	struct core_component *comp;
 
-	list_for_each_entry(aim, &mc.comp_list, list) {
-		if (!strcmp(aim->name, name))
-			return aim;
+	list_for_each_entry(comp, &mc.comp_list, list) {
+		if (!strcmp(comp->name, name))
+			return comp;
 	}
 	return NULL;
 }
@@ -556,19 +556,19 @@ int print_links(struct device *dev, void *data)
 	struct most_interface *iface = to_most_interface(dev);
 
 	list_for_each_entry(c, &iface->p->channel_list, list) {
-		if (c->pipe0.aim) {
+		if (c->pipe0.comp) {
 			offs += snprintf(buf + offs,
 					 PAGE_SIZE - offs,
 					 "%s:%s:%s\n",
-					 c->pipe0.aim->name,
+					 c->pipe0.comp->name,
 					 dev_name(&iface->dev),
 					 dev_name(&c->dev));
 		}
-		if (c->pipe1.aim) {
+		if (c->pipe1.comp) {
 			offs += snprintf(buf + offs,
 					 PAGE_SIZE - offs,
 					 "%s:%s:%s\n",
-					 c->pipe1.aim->name,
+					 c->pipe1.comp->name,
 					 dev_name(&iface->dev),
 					 dev_name(&c->dev));
 		}
@@ -584,12 +584,12 @@ static ssize_t links_show(struct device_driver *drv, char *buf)
 
 static ssize_t modules_show(struct device_driver *drv, char *buf)
 {
-	struct core_component *aim;
+	struct core_component *comp;
 	int offs = 0;
 
-	list_for_each_entry(aim, &mc.comp_list, list) {
+	list_for_each_entry(comp, &mc.comp_list, list) {
 		offs += snprintf(buf + offs, PAGE_SIZE - offs, "%s\n",
-				 aim->name);
+				 comp->name);
 	}
 	return offs;
 }
@@ -667,24 +667,25 @@ static struct most_channel *get_channel(char *mdev, char *mdev_ch)
 }
 
 static
-inline int link_channel_to_aim(struct most_channel *c, struct core_component *aim,
-			       char *aim_param)
+inline int link_channel_to_aim(struct most_channel *c,
+			       struct core_component *comp,
+			       char *comp_param)
 {
 	int ret;
-	struct core_component **aim_ptr;
+	struct core_component **comp_ptr;
 
-	if (!c->pipe0.aim)
-		aim_ptr = &c->pipe0.aim;
-	else if (!c->pipe1.aim)
-		aim_ptr = &c->pipe1.aim;
+	if (!c->pipe0.comp)
+		comp_ptr = &c->pipe0.comp;
+	else if (!c->pipe1.comp)
+		comp_ptr = &c->pipe1.comp;
 	else
 		return -ENOSPC;
 
-	*aim_ptr = aim;
-	ret = aim->probe_channel(c->iface, c->channel_id,
-				 &c->cfg, aim_param);
+	*comp_ptr = comp;
+	ret = comp->probe_channel(c->iface, c->channel_id,
+				 &c->cfg, comp_param);
 	if (ret) {
-		*aim_ptr = NULL;
+		*comp_ptr = NULL;
 		return ret;
 	}
 
@@ -718,33 +719,33 @@ static ssize_t add_link_store(struct device_driver *drv,
 			      size_t len)
 {
 	struct most_channel *c;
-	struct core_component *aim;
+	struct core_component *comp;
 	char buffer[STRING_SIZE];
 	char *mdev;
 	char *mdev_ch;
-	char *aim_name;
-	char *aim_param;
+	char *comp_name;
+	char *comp_param;
 	char devnod_buf[STRING_SIZE];
 	int ret;
 	size_t max_len = min_t(size_t, len + 1, STRING_SIZE);
 
 	strlcpy(buffer, buf, max_len);
 
-	ret = split_string(buffer, &mdev, &mdev_ch, &aim_name, &aim_param);
+	ret = split_string(buffer, &mdev, &mdev_ch, &comp_name, &comp_param);
 	if (ret)
 		return ret;
-	aim = match_module(aim_name);
-	if (!aim_param || *aim_param == 0) {
+	comp = match_module(comp_name);
+	if (!comp_param || *comp_param == 0) {
 		snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev,
 			 mdev_ch);
-		aim_param = devnod_buf;
+		comp_param = devnod_buf;
 	}
 
 	c = get_channel(mdev, mdev_ch);
 	if (!c)
 		return -ENODEV;
 
-	ret = link_channel_to_aim(c, aim, aim_param);
+	ret = link_channel_to_aim(c, comp, comp_param);
 	if (ret)
 		return ret;
 
@@ -766,29 +767,29 @@ static ssize_t remove_link_store(struct device_driver *drv,
 				 size_t len)
 {
 	struct most_channel *c;
-	struct core_component *aim;
+	struct core_component *comp;
 	char buffer[STRING_SIZE];
 	char *mdev;
 	char *mdev_ch;
-	char *aim_name;
+	char *comp_name;
 	int ret;
 	size_t max_len = min_t(size_t, len + 1, STRING_SIZE);
 
 	strlcpy(buffer, buf, max_len);
-	ret = split_string(buffer, &mdev, &mdev_ch, &aim_name, NULL);
+	ret = split_string(buffer, &mdev, &mdev_ch, &comp_name, NULL);
 	if (ret)
 		return ret;
-	aim = match_module(aim_name);
+	comp = match_module(comp_name);
 	c = get_channel(mdev, mdev_ch);
 	if (!c)
 		return -ENODEV;
 
-	if (aim->disconnect_channel(c->iface, c->channel_id))
+	if (comp->disconnect_channel(c->iface, c->channel_id))
 		return -EIO;
-	if (c->pipe0.aim == aim)
-		c->pipe0.aim = NULL;
-	if (c->pipe1.aim == aim)
-		c->pipe1.aim = NULL;
+	if (c->pipe0.comp == comp)
+		c->pipe0.comp = NULL;
+	if (c->pipe1.comp == comp)
+		c->pipe1.comp = NULL;
 	return len;
 }
 
@@ -945,11 +946,11 @@ static void arm_mbo(struct mbo *mbo)
 	list_add_tail(&mbo->list, &c->fifo);
 	spin_unlock_irqrestore(&c->fifo_lock, flags);
 
-	if (c->pipe0.refs && c->pipe0.aim->tx_completion)
-		c->pipe0.aim->tx_completion(c->iface, c->channel_id);
+	if (c->pipe0.refs && c->pipe0.comp->tx_completion)
+		c->pipe0.comp->tx_completion(c->iface, c->channel_id);
 
-	if (c->pipe1.refs && c->pipe1.aim->tx_completion)
-		c->pipe1.aim->tx_completion(c->iface, c->channel_id);
+	if (c->pipe1.refs && c->pipe1.comp->tx_completion)
+		c->pipe1.comp->tx_completion(c->iface, c->channel_id);
 }
 
 /**
@@ -1046,7 +1047,8 @@ static void most_write_completion(struct mbo *mbo)
 		arm_mbo(mbo);
 }
 
-int channel_has_mbo(struct most_interface *iface, int id, struct core_component *aim)
+int channel_has_mbo(struct most_interface *iface, int id,
+		    struct core_component *comp)
 {
 	struct most_channel *c = iface->p->channel[id];
 	unsigned long flags;
@@ -1056,8 +1058,8 @@ int channel_has_mbo(struct most_interface *iface, int id, struct core_component
 		return -EINVAL;
 
 	if (c->pipe0.refs && c->pipe1.refs &&
-	    ((aim == c->pipe0.aim && c->pipe0.num_buffers <= 0) ||
-	     (aim == c->pipe1.aim && c->pipe1.num_buffers <= 0)))
+	    ((comp == c->pipe0.comp && c->pipe0.num_buffers <= 0) ||
+	     (comp == c->pipe1.comp && c->pipe1.num_buffers <= 0)))
 		return 0;
 
 	spin_lock_irqsave(&c->fifo_lock, flags);
@@ -1076,7 +1078,7 @@ EXPORT_SYMBOL_GPL(channel_has_mbo);
  * Returns a pointer to MBO on success or NULL otherwise.
  */
 struct mbo *most_get_mbo(struct most_interface *iface, int id,
-			 struct core_component *aim)
+			 struct core_component *comp)
 {
 	struct mbo *mbo;
 	struct most_channel *c;
@@ -1088,13 +1090,13 @@ struct mbo *most_get_mbo(struct most_interface *iface, int id,
 		return NULL;
 
 	if (c->pipe0.refs && c->pipe1.refs &&
-	    ((aim == c->pipe0.aim && c->pipe0.num_buffers <= 0) ||
-	     (aim == c->pipe1.aim && c->pipe1.num_buffers <= 0)))
+	    ((comp == c->pipe0.comp && c->pipe0.num_buffers <= 0) ||
+	     (comp == c->pipe1.comp && c->pipe1.num_buffers <= 0)))
 		return NULL;
 
-	if (aim == c->pipe0.aim)
+	if (comp == c->pipe0.comp)
 		num_buffers_ptr = &c->pipe0.num_buffers;
-	else if (aim == c->pipe1.aim)
+	else if (comp == c->pipe1.comp)
 		num_buffers_ptr = &c->pipe1.num_buffers;
 	else
 		num_buffers_ptr = &dummy_num_buffers;
@@ -1159,12 +1161,12 @@ static void most_read_completion(struct mbo *mbo)
 	if (atomic_sub_and_test(1, &c->mbo_nq_level))
 		c->is_starving = 1;
 
-	if (c->pipe0.refs && c->pipe0.aim->rx_completion &&
-	    c->pipe0.aim->rx_completion(mbo) == 0)
+	if (c->pipe0.refs && c->pipe0.comp->rx_completion &&
+	    c->pipe0.comp->rx_completion(mbo) == 0)
 		return;
 
-	if (c->pipe1.refs && c->pipe1.aim->rx_completion &&
-	    c->pipe1.aim->rx_completion(mbo) == 0)
+	if (c->pipe1.refs && c->pipe1.comp->rx_completion &&
+	    c->pipe1.comp->rx_completion(mbo) == 0)
 		return;
 
 	most_put_mbo(mbo);
@@ -1181,7 +1183,7 @@ static void most_read_completion(struct mbo *mbo)
  * Returns 0 on success or error code otherwise.
  */
 int most_start_channel(struct most_interface *iface, int id,
-		       struct core_component *aim)
+		       struct core_component *comp)
 {
 	int num_buffer;
 	int ret;
@@ -1192,7 +1194,7 @@ int most_start_channel(struct most_interface *iface, int id,
 
 	mutex_lock(&c->start_mutex);
 	if (c->pipe0.refs + c->pipe1.refs > 0)
-		goto out; /* already started by other aim */
+		goto out; /* already started by other comp */
 
 	if (!try_module_get(iface->mod)) {
 		pr_info("failed to acquire HDM lock\n");
@@ -1231,9 +1233,9 @@ int most_start_channel(struct most_interface *iface, int id,
 	atomic_set(&c->mbo_ref, num_buffer);
 
 out:
-	if (aim == c->pipe0.aim)
+	if (comp == c->pipe0.comp)
 		c->pipe0.refs++;
-	if (aim == c->pipe1.aim)
+	if (comp == c->pipe1.comp)
 		c->pipe1.refs++;
 	mutex_unlock(&c->start_mutex);
 	return 0;
@@ -1251,7 +1253,7 @@ EXPORT_SYMBOL_GPL(most_start_channel);
  * @id: channel ID
  */
 int most_stop_channel(struct most_interface *iface, int id,
-		      struct core_component *aim)
+		      struct core_component *comp)
 {
 	struct most_channel *c;
 
@@ -1296,9 +1298,9 @@ int most_stop_channel(struct most_interface *iface, int id,
 	c->is_poisoned = false;
 
 out:
-	if (aim == c->pipe0.aim)
+	if (comp == c->pipe0.comp)
 		c->pipe0.refs--;
-	if (aim == c->pipe1.aim)
+	if (comp == c->pipe1.comp)
 		c->pipe1.refs--;
 	mutex_unlock(&c->start_mutex);
 	return 0;
@@ -1309,14 +1311,14 @@ EXPORT_SYMBOL_GPL(most_stop_channel);
  * most_register_component - registers an AIM (driver) with the core
  * @aim: instance of AIM to be registered
  */
-int most_register_component(struct core_component *aim)
+int most_register_component(struct core_component *comp)
 {
-	if (!aim) {
+	if (!comp) {
 		pr_err("Bad driver\n");
 		return -EINVAL;
 	}
-	list_add_tail(&aim->list, &mc.comp_list);
-	pr_info("registered new application interfacing module %s\n", aim->name);
+	list_add_tail(&comp->list, &mc.comp_list);
+	pr_info("registered new application interfacing module %s\n", comp->name);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(most_register_component);
@@ -1325,16 +1327,16 @@ static int disconnect_channels(struct device *dev, void *data)
 {
 	struct most_interface *iface;
 	struct most_channel *c, *tmp;
-	struct core_component *aim = data;
+	struct core_component *comp = data;
 
 	iface = to_most_interface(dev);
 	list_for_each_entry_safe(c, tmp, &iface->p->channel_list, list) {
-		if (c->pipe0.aim == aim || c->pipe1.aim == aim)
-			aim->disconnect_channel(c->iface, c->channel_id);
-		if (c->pipe0.aim == aim)
-			c->pipe0.aim = NULL;
-		if (c->pipe1.aim == aim)
-			c->pipe1.aim = NULL;
+		if (c->pipe0.comp == comp || c->pipe1.comp == comp)
+			comp->disconnect_channel(c->iface, c->channel_id);
+		if (c->pipe0.comp == comp)
+			c->pipe0.comp = NULL;
+		if (c->pipe1.comp == comp)
+			c->pipe1.comp = NULL;
 	}
 	return 0;
 }
@@ -1343,16 +1345,16 @@ static int disconnect_channels(struct device *dev, void *data)
  * most_deregister_component - deregisters an AIM (driver) with the core
  * @aim: AIM to be removed
  */
-int most_deregister_component(struct core_component *aim)
+int most_deregister_component(struct core_component *comp)
 {
-	if (!aim) {
+	if (!comp) {
 		pr_err("Bad driver\n");
 		return -EINVAL;
 	}
 
-	bus_for_each_dev(&mc.bus, NULL, aim, disconnect_channels);
-	list_del(&aim->list);
-	pr_info("deregistering module %s\n", aim->name);
+	bus_for_each_dev(&mc.bus, NULL, comp, disconnect_channels);
+	list_del(&comp->list);
+	pr_info("deregistering module %s\n", comp->name);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(most_deregister_component);
@@ -1490,14 +1492,14 @@ void most_deregister_interface(struct most_interface *iface)
 	pr_info("deregistering MOST device %s (%s)\n", dev_name(&iface->dev), iface->description);
 	for (i = 0; i < iface->num_channels; i++) {
 		c = iface->p->channel[i];
-		if (c->pipe0.aim)
-			c->pipe0.aim->disconnect_channel(c->iface,
+		if (c->pipe0.comp)
+			c->pipe0.comp->disconnect_channel(c->iface,
 							c->channel_id);
-		if (c->pipe1.aim)
-			c->pipe1.aim->disconnect_channel(c->iface,
+		if (c->pipe1.comp)
+			c->pipe1.comp->disconnect_channel(c->iface,
 							c->channel_id);
-		c->pipe0.aim = NULL;
-		c->pipe1.aim = NULL;
+		c->pipe0.comp = NULL;
+		c->pipe1.comp = NULL;
 		list_del(&c->list);
 		device_unregister(&c->dev);
 		kfree(c);
-- 
2.7.4

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

* [PATCH 30/50] staging: most: core: rename function link_channel_to_aim
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (28 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 29/50] staging: most: core: rename aim variables Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 31/50] staging: most: net: remove aim designators Christian Gromm
                   ` (21 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the function link_channel_to_aim to
link_channel_to_component. It is needed because userspace
interfacing modules are referred to as components.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index c80fb9b..6d7fe7d 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -667,9 +667,9 @@ static struct most_channel *get_channel(char *mdev, char *mdev_ch)
 }
 
 static
-inline int link_channel_to_aim(struct most_channel *c,
-			       struct core_component *comp,
-			       char *comp_param)
+inline int link_channel_to_component(struct most_channel *c,
+				     struct core_component *comp,
+				     char *comp_param)
 {
 	int ret;
 	struct core_component **comp_ptr;
@@ -745,7 +745,7 @@ static ssize_t add_link_store(struct device_driver *drv,
 	if (!c)
 		return -ENODEV;
 
-	ret = link_channel_to_aim(c, comp, comp_param);
+	ret = link_channel_to_component(c, comp, comp_param);
 	if (ret)
 		return ret;
 
-- 
2.7.4

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

* [PATCH 31/50] staging: most: net: remove aim designators
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (29 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 30/50] staging: most: core: rename function link_channel_to_aim Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 32/50] staging: most: sound: remove aim designator Christian Gromm
                   ` (20 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the all aim designators with comp. It is needed because
userspace interfacing modules are referred to as components.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/net/net.c | 44 +++++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c
index a7c7c58..00a5ddf 100644
--- a/drivers/staging/most/net/net.c
+++ b/drivers/staging/most/net/net.c
@@ -1,5 +1,5 @@
 /*
- * Networking AIM - Networking Application Interface Module for MostCore
+ * Networking component - Networking Application Interface Module for MostCore
  *
  * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG
  *
@@ -74,7 +74,7 @@ struct net_dev_context {
 static struct list_head net_devices = LIST_HEAD_INIT(net_devices);
 static struct mutex probe_disc_mt; /* ch->linked = true, most_nd_open */
 static struct spinlock list_lock; /* list_head, ch->linked = false, dev_hold */
-static struct core_component aim;
+static struct core_component comp;
 
 static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo)
 {
@@ -184,15 +184,15 @@ static int most_nd_open(struct net_device *dev)
 
 	mutex_lock(&probe_disc_mt);
 
-	if (most_start_channel(nd->iface, nd->rx.ch_id, &aim)) {
+	if (most_start_channel(nd->iface, nd->rx.ch_id, &comp)) {
 		netdev_err(dev, "most_start_channel() failed\n");
 		ret = -EBUSY;
 		goto unlock;
 	}
 
-	if (most_start_channel(nd->iface, nd->tx.ch_id, &aim)) {
+	if (most_start_channel(nd->iface, nd->tx.ch_id, &comp)) {
 		netdev_err(dev, "most_start_channel() failed\n");
-		most_stop_channel(nd->iface, nd->rx.ch_id, &aim);
+		most_stop_channel(nd->iface, nd->rx.ch_id, &comp);
 		ret = -EBUSY;
 		goto unlock;
 	}
@@ -218,8 +218,8 @@ static int most_nd_stop(struct net_device *dev)
 	netif_stop_queue(dev);
 	if (nd->iface->request_netinfo)
 		nd->iface->request_netinfo(nd->iface, nd->tx.ch_id, NULL);
-	most_stop_channel(nd->iface, nd->rx.ch_id, &aim);
-	most_stop_channel(nd->iface, nd->tx.ch_id, &aim);
+	most_stop_channel(nd->iface, nd->rx.ch_id, &comp);
+	most_stop_channel(nd->iface, nd->tx.ch_id, &comp);
 
 	return 0;
 }
@@ -231,7 +231,7 @@ static netdev_tx_t most_nd_start_xmit(struct sk_buff *skb,
 	struct mbo *mbo;
 	int ret;
 
-	mbo = most_get_mbo(nd->iface, nd->tx.ch_id, &aim);
+	mbo = most_get_mbo(nd->iface, nd->tx.ch_id, &comp);
 
 	if (!mbo) {
 		netif_stop_queue(dev);
@@ -296,8 +296,8 @@ static struct net_dev_context *get_net_dev_hold(struct most_interface *iface)
 	return nd;
 }
 
-static int aim_probe_channel(struct most_interface *iface, int channel_idx,
-			     struct most_channel_config *ccfg, char *name)
+static int comp_probe_channel(struct most_interface *iface, int channel_idx,
+			      struct most_channel_config *ccfg, char *name)
 {
 	struct net_dev_context *nd;
 	struct net_dev_channel *ch;
@@ -352,8 +352,8 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx,
 	return ret;
 }
 
-static int aim_disconnect_channel(struct most_interface *iface,
-				  int channel_idx)
+static int comp_disconnect_channel(struct most_interface *iface,
+				   int channel_idx)
 {
 	struct net_dev_context *nd;
 	struct net_dev_channel *ch;
@@ -399,8 +399,8 @@ static int aim_disconnect_channel(struct most_interface *iface,
 	return ret;
 }
 
-static int aim_resume_tx_channel(struct most_interface *iface,
-				 int channel_idx)
+static int comp_resume_tx_channel(struct most_interface *iface,
+				  int channel_idx)
 {
 	struct net_dev_context *nd;
 
@@ -418,7 +418,7 @@ static int aim_resume_tx_channel(struct most_interface *iface,
 	return 0;
 }
 
-static int aim_rx_data(struct mbo *mbo)
+static int comp_rx_data(struct mbo *mbo)
 {
 	const u32 zero = 0;
 	struct net_dev_context *nd;
@@ -500,24 +500,24 @@ static int aim_rx_data(struct mbo *mbo)
 	return ret;
 }
 
-static struct core_component aim = {
+static struct core_component comp = {
 	.name = "net",
-	.probe_channel = aim_probe_channel,
-	.disconnect_channel = aim_disconnect_channel,
-	.tx_completion = aim_resume_tx_channel,
-	.rx_completion = aim_rx_data,
+	.probe_channel = comp_probe_channel,
+	.disconnect_channel = comp_disconnect_channel,
+	.tx_completion = comp_resume_tx_channel,
+	.rx_completion = comp_rx_data,
 };
 
 static int __init most_net_init(void)
 {
 	spin_lock_init(&list_lock);
 	mutex_init(&probe_disc_mt);
-	return most_register_component(&aim);
+	return most_register_component(&comp);
 }
 
 static void __exit most_net_exit(void)
 {
-	most_deregister_component(&aim);
+	most_deregister_component(&comp);
 }
 
 /**
-- 
2.7.4

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

* [PATCH 32/50] staging: most: sound: remove aim designator
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (30 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 31/50] staging: most: net: remove aim designators Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 33/50] staging: most: video: remove aim designators Christian Gromm
                   ` (19 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch removes all 'aim' designators and replaces them with 'comp'.  It
is needd because userspace interfacing modules are referred to as
components.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/sound/sound.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c
index 85bb024..2c9e6c9 100644
--- a/drivers/staging/most/sound/sound.c
+++ b/drivers/staging/most/sound/sound.c
@@ -1,5 +1,5 @@
 /*
- * sound.c - Audio Application Interface Module for Mostcore
+ * sound.c - Sound component for Mostcore
  *
  * Copyright (C) 2015 Microchip Technology Germany II GmbH & Co. KG
  *
@@ -27,7 +27,7 @@
 #define DRIVER_NAME "sound"
 
 static struct list_head dev_list;
-static struct core_component audio_aim;
+static struct core_component comp;
 
 /**
  * struct channel - private structure to keep channel specific data
@@ -240,7 +240,7 @@ static int playback_thread(void *data)
 			kthread_should_stop() ||
 			(channel->is_stream_running &&
 			 (mbo = most_get_mbo(channel->iface, channel->id,
-					     &audio_aim))));
+					     &comp))));
 		if (!mbo)
 			continue;
 
@@ -283,7 +283,7 @@ static int pcm_open(struct snd_pcm_substream *substream)
 		}
 	}
 
-	if (most_start_channel(channel->iface, channel->id, &audio_aim)) {
+	if (most_start_channel(channel->iface, channel->id, &comp)) {
 		pr_err("most_start_channel() failed!\n");
 		if (cfg->direction == MOST_CH_TX)
 			kthread_stop(channel->playback_task);
@@ -310,7 +310,7 @@ static int pcm_close(struct snd_pcm_substream *substream)
 
 	if (channel->cfg->direction == MOST_CH_TX)
 		kthread_stop(channel->playback_task);
-	most_stop_channel(channel->iface, channel->id, &audio_aim);
+	most_stop_channel(channel->iface, channel->id, &comp);
 
 	return 0;
 }
@@ -725,7 +725,7 @@ static int audio_tx_completion(struct most_interface *iface, int channel_id)
 /**
  * Initialization of the struct core_component
  */
-static struct core_component audio_aim = {
+static struct core_component comp = {
 	.name = DRIVER_NAME,
 	.probe_channel = audio_probe_channel,
 	.disconnect_channel = audio_disconnect_channel,
@@ -739,7 +739,7 @@ static int __init audio_init(void)
 
 	INIT_LIST_HEAD(&dev_list);
 
-	return most_register_component(&audio_aim);
+	return most_register_component(&comp);
 }
 
 static void __exit audio_exit(void)
@@ -753,7 +753,7 @@ static void __exit audio_exit(void)
 		snd_card_free(channel->card);
 	}
 
-	most_deregister_component(&audio_aim);
+	most_deregister_component(&comp);
 }
 
 module_init(audio_init);
-- 
2.7.4

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

* [PATCH 33/50] staging: most: video: remove aim designators
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (31 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 32/50] staging: most: sound: remove aim designator Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 34/50] staging: most: cdev: rename struct aim_channel Christian Gromm
                   ` (18 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch takes the 'aim' prefixes and variable names off the module and
uses component instead. It is needed because userspace interfacing modules
are referred to as components.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/video/video.c | 152 ++++++++++++++++++-------------------
 1 file changed, 76 insertions(+), 76 deletions(-)

diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
index 34ffdab..b06488b 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -1,5 +1,5 @@
 /*
- * V4L2 AIM - V4L2 Application Interface Module for MostCore
+ * V4L2 Component - V4L2 Application Interface Module for MostCore
  *
  * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG
  *
@@ -29,9 +29,9 @@
 
 #include "most/core.h"
 
-#define V4L2_AIM_MAX_INPUT  1
+#define V4L2_CMP_MAX_INPUT  1
 
-static struct core_component aim_info;
+static struct core_component comp;
 
 struct most_video_dev {
 	struct most_interface *iface;
@@ -52,7 +52,7 @@ struct most_video_dev {
 	wait_queue_head_t wait_data;
 };
 
-struct aim_fh {
+struct comp_fh {
 	/* must be the first field of this struct! */
 	struct v4l2_fh fh;
 	struct most_video_dev *mdev;
@@ -72,14 +72,14 @@ static inline struct mbo *get_top_mbo(struct most_video_dev *mdev)
 	return list_first_entry(&mdev->pending_mbos, struct mbo, list);
 }
 
-static int aim_vdev_open(struct file *filp)
+static int comp_vdev_open(struct file *filp)
 {
 	int ret;
 	struct video_device *vdev = video_devdata(filp);
 	struct most_video_dev *mdev = video_drvdata(filp);
-	struct aim_fh *fh;
+	struct comp_fh *fh;
 
-	v4l2_info(&mdev->v4l2_dev, "aim_vdev_open()\n");
+	v4l2_info(&mdev->v4l2_dev, "comp_vdev_open()\n");
 
 	switch (vdev->vfl_type) {
 	case VFL_TYPE_GRABBER:
@@ -104,7 +104,7 @@ static int aim_vdev_open(struct file *filp)
 
 	v4l2_fh_add(&fh->fh);
 
-	ret = most_start_channel(mdev->iface, mdev->ch_idx, &aim_info);
+	ret = most_start_channel(mdev->iface, mdev->ch_idx, &comp);
 	if (ret) {
 		v4l2_err(&mdev->v4l2_dev, "most_start_channel() failed\n");
 		goto err_rm;
@@ -122,13 +122,13 @@ static int aim_vdev_open(struct file *filp)
 	return ret;
 }
 
-static int aim_vdev_close(struct file *filp)
+static int comp_vdev_close(struct file *filp)
 {
-	struct aim_fh *fh = filp->private_data;
+	struct comp_fh *fh = filp->private_data;
 	struct most_video_dev *mdev = fh->mdev;
 	struct mbo *mbo, *tmp;
 
-	v4l2_info(&mdev->v4l2_dev, "aim_vdev_close()\n");
+	v4l2_info(&mdev->v4l2_dev, "comp_vdev_close()\n");
 
 	/*
 	 * We need to put MBOs back before we call most_stop_channel()
@@ -148,7 +148,7 @@ static int aim_vdev_close(struct file *filp)
 		spin_lock_irq(&mdev->list_lock);
 	}
 	spin_unlock_irq(&mdev->list_lock);
-	most_stop_channel(mdev->iface, mdev->ch_idx, &aim_info);
+	most_stop_channel(mdev->iface, mdev->ch_idx, &comp);
 	mdev->mute = false;
 
 	v4l2_fh_del(&fh->fh);
@@ -159,10 +159,10 @@ static int aim_vdev_close(struct file *filp)
 	return 0;
 }
 
-static ssize_t aim_vdev_read(struct file *filp, char __user *buf,
-			     size_t count, loff_t *pos)
+static ssize_t comp_vdev_read(struct file *filp, char __user *buf,
+			      size_t count, loff_t *pos)
 {
-	struct aim_fh *fh = filp->private_data;
+	struct comp_fh *fh = filp->private_data;
 	struct most_video_dev *mdev = fh->mdev;
 	int ret = 0;
 
@@ -209,9 +209,9 @@ static ssize_t aim_vdev_read(struct file *filp, char __user *buf,
 	return ret;
 }
 
-static unsigned int aim_vdev_poll(struct file *filp, poll_table *wait)
+static unsigned int comp_vdev_poll(struct file *filp, poll_table *wait)
 {
-	struct aim_fh *fh = filp->private_data;
+	struct comp_fh *fh = filp->private_data;
 	struct most_video_dev *mdev = fh->mdev;
 	unsigned int mask = 0;
 
@@ -224,7 +224,7 @@ static unsigned int aim_vdev_poll(struct file *filp, poll_table *wait)
 	return mask;
 }
 
-static void aim_set_format_struct(struct v4l2_format *f)
+static void comp_set_format_struct(struct v4l2_format *f)
 {
 	f->fmt.pix.width = 8;
 	f->fmt.pix.height = 8;
@@ -236,8 +236,8 @@ static void aim_set_format_struct(struct v4l2_format *f)
 	f->fmt.pix.priv = 0;
 }
 
-static int aim_set_format(struct most_video_dev *mdev, unsigned int cmd,
-			  struct v4l2_format *format)
+static int comp_set_format(struct most_video_dev *mdev, unsigned int cmd,
+			   struct v4l2_format *format)
 {
 	if (format->fmt.pix.pixelformat != V4L2_PIX_FMT_MPEG)
 		return -EINVAL;
@@ -245,7 +245,7 @@ static int aim_set_format(struct most_video_dev *mdev, unsigned int cmd,
 	if (cmd == VIDIOC_TRY_FMT)
 		return 0;
 
-	aim_set_format_struct(format);
+	comp_set_format_struct(format);
 
 	return 0;
 }
@@ -253,12 +253,12 @@ static int aim_set_format(struct most_video_dev *mdev, unsigned int cmd,
 static int vidioc_querycap(struct file *file, void *priv,
 			   struct v4l2_capability *cap)
 {
-	struct aim_fh *fh = priv;
+	struct comp_fh *fh = priv;
 	struct most_video_dev *mdev = fh->mdev;
 
 	v4l2_info(&mdev->v4l2_dev, "vidioc_querycap()\n");
 
-	strlcpy(cap->driver, "v4l2_most_aim", sizeof(cap->driver));
+	strlcpy(cap->driver, "v4l2_component", sizeof(cap->driver));
 	strlcpy(cap->card, "MOST", sizeof(cap->card));
 	snprintf(cap->bus_info, sizeof(cap->bus_info),
 		 "%s", mdev->iface->description);
@@ -273,7 +273,7 @@ static int vidioc_querycap(struct file *file, void *priv,
 static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
 				   struct v4l2_fmtdesc *f)
 {
-	struct aim_fh *fh = priv;
+	struct comp_fh *fh = priv;
 	struct most_video_dev *mdev = fh->mdev;
 
 	v4l2_info(&mdev->v4l2_dev, "vidioc_enum_fmt_vid_cap() %d\n", f->index);
@@ -292,36 +292,36 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
 static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
 				struct v4l2_format *f)
 {
-	struct aim_fh *fh = priv;
+	struct comp_fh *fh = priv;
 	struct most_video_dev *mdev = fh->mdev;
 
 	v4l2_info(&mdev->v4l2_dev, "vidioc_g_fmt_vid_cap()\n");
 
-	aim_set_format_struct(f);
+	comp_set_format_struct(f);
 	return 0;
 }
 
 static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
 				  struct v4l2_format *f)
 {
-	struct aim_fh *fh = priv;
+	struct comp_fh *fh = priv;
 	struct most_video_dev *mdev = fh->mdev;
 
-	return aim_set_format(mdev, VIDIOC_TRY_FMT, f);
+	return comp_set_format(mdev, VIDIOC_TRY_FMT, f);
 }
 
 static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
 				struct v4l2_format *f)
 {
-	struct aim_fh *fh = priv;
+	struct comp_fh *fh = priv;
 	struct most_video_dev *mdev = fh->mdev;
 
-	return aim_set_format(mdev, VIDIOC_S_FMT, f);
+	return comp_set_format(mdev, VIDIOC_S_FMT, f);
 }
 
 static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm)
 {
-	struct aim_fh *fh = priv;
+	struct comp_fh *fh = priv;
 	struct most_video_dev *mdev = fh->mdev;
 
 	v4l2_info(&mdev->v4l2_dev, "vidioc_g_std()\n");
@@ -333,10 +333,10 @@ static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm)
 static int vidioc_enum_input(struct file *file, void *priv,
 			     struct v4l2_input *input)
 {
-	struct aim_fh *fh = priv;
+	struct comp_fh *fh = priv;
 	struct most_video_dev *mdev = fh->mdev;
 
-	if (input->index >= V4L2_AIM_MAX_INPUT)
+	if (input->index >= V4L2_CMP_MAX_INPUT)
 		return -EINVAL;
 
 	strcpy(input->name, "MOST Video");
@@ -350,7 +350,7 @@ static int vidioc_enum_input(struct file *file, void *priv,
 
 static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
 {
-	struct aim_fh *fh = priv;
+	struct comp_fh *fh = priv;
 	struct most_video_dev *mdev = fh->mdev;
 	*i = mdev->ctrl_input;
 	return 0;
@@ -358,23 +358,23 @@ static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
 
 static int vidioc_s_input(struct file *file, void *priv, unsigned int index)
 {
-	struct aim_fh *fh = priv;
+	struct comp_fh *fh = priv;
 	struct most_video_dev *mdev = fh->mdev;
 
 	v4l2_info(&mdev->v4l2_dev, "vidioc_s_input(%d)\n", index);
 
-	if (index >= V4L2_AIM_MAX_INPUT)
+	if (index >= V4L2_CMP_MAX_INPUT)
 		return -EINVAL;
 	mdev->ctrl_input = index;
 	return 0;
 }
 
-static const struct v4l2_file_operations aim_fops = {
+static const struct v4l2_file_operations comp_fops = {
 	.owner      = THIS_MODULE,
-	.open       = aim_vdev_open,
-	.release    = aim_vdev_close,
-	.read       = aim_vdev_read,
-	.poll       = aim_vdev_poll,
+	.open       = comp_vdev_open,
+	.release    = comp_vdev_close,
+	.read       = comp_vdev_read,
+	.poll       = comp_vdev_poll,
 	.unlocked_ioctl = video_ioctl2,
 };
 
@@ -390,8 +390,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
 	.vidioc_s_input             = vidioc_s_input,
 };
 
-static const struct video_device aim_videodev_template = {
-	.fops = &aim_fops,
+static const struct video_device comp_videodev_template = {
+	.fops = &comp_fops,
 	.release = video_device_release,
 	.ioctl_ops = &video_ioctl_ops,
 	.tvnorms = V4L2_STD_UNKNOWN,
@@ -399,7 +399,7 @@ static const struct video_device aim_videodev_template = {
 
 /**************************************************************************/
 
-static struct most_video_dev *get_aim_dev(
+static struct most_video_dev *get_comp_dev(
 	struct most_interface *iface, int channel_idx)
 {
 	struct most_video_dev *mdev;
@@ -416,11 +416,11 @@ static struct most_video_dev *get_aim_dev(
 	return NULL;
 }
 
-static int aim_rx_data(struct mbo *mbo)
+static int comp_rx_data(struct mbo *mbo)
 {
 	unsigned long flags;
 	struct most_video_dev *mdev =
-		get_aim_dev(mbo->ifp, mbo->hdm_channel_id);
+		get_comp_dev(mbo->ifp, mbo->hdm_channel_id);
 
 	if (!mdev)
 		return -EIO;
@@ -437,11 +437,11 @@ static int aim_rx_data(struct mbo *mbo)
 	return 0;
 }
 
-static int aim_register_videodev(struct most_video_dev *mdev)
+static int comp_register_videodev(struct most_video_dev *mdev)
 {
 	int ret;
 
-	v4l2_info(&mdev->v4l2_dev, "aim_register_videodev()\n");
+	v4l2_info(&mdev->v4l2_dev, "comp_register_videodev()\n");
 
 	init_waitqueue_head(&mdev->wait_data);
 
@@ -451,7 +451,7 @@ static int aim_register_videodev(struct most_video_dev *mdev)
 		return -ENOMEM;
 
 	/* Fill the video capture device struct */
-	*mdev->vdev = aim_videodev_template;
+	*mdev->vdev = comp_videodev_template;
 	mdev->vdev->v4l2_dev = &mdev->v4l2_dev;
 	mdev->vdev->lock = &mdev->lock;
 	snprintf(mdev->vdev->name, sizeof(mdev->vdev->name), "MOST: %s",
@@ -469,14 +469,14 @@ static int aim_register_videodev(struct most_video_dev *mdev)
 	return ret;
 }
 
-static void aim_unregister_videodev(struct most_video_dev *mdev)
+static void comp_unregister_videodev(struct most_video_dev *mdev)
 {
-	v4l2_info(&mdev->v4l2_dev, "aim_unregister_videodev()\n");
+	v4l2_info(&mdev->v4l2_dev, "comp_unregister_videodev()\n");
 
 	video_unregister_device(mdev->vdev);
 }
 
-static void aim_v4l2_dev_release(struct v4l2_device *v4l2_dev)
+static void comp_v4l2_dev_release(struct v4l2_device *v4l2_dev)
 {
 	struct most_video_dev *mdev =
 		container_of(v4l2_dev, struct most_video_dev, v4l2_dev);
@@ -485,13 +485,13 @@ static void aim_v4l2_dev_release(struct v4l2_device *v4l2_dev)
 	kfree(mdev);
 }
 
-static int aim_probe_channel(struct most_interface *iface, int channel_idx,
-			     struct most_channel_config *ccfg, char *name)
+static int comp_probe_channel(struct most_interface *iface, int channel_idx,
+			      struct most_channel_config *ccfg, char *name)
 {
 	int ret;
-	struct most_video_dev *mdev = get_aim_dev(iface, channel_idx);
+	struct most_video_dev *mdev = get_comp_dev(iface, channel_idx);
 
-	pr_info("aim_probe_channel(%s)\n", name);
+	pr_info("comp_probe_channel(%s)\n", name);
 
 	if (mdev) {
 		pr_err("channel already linked\n");
@@ -519,7 +519,7 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx,
 	INIT_LIST_HEAD(&mdev->pending_mbos);
 	mdev->iface = iface;
 	mdev->ch_idx = channel_idx;
-	mdev->v4l2_dev.release = aim_v4l2_dev_release;
+	mdev->v4l2_dev.release = comp_v4l2_dev_release;
 
 	/* Create the v4l2_device */
 	strlcpy(mdev->v4l2_dev.name, name, sizeof(mdev->v4l2_dev.name));
@@ -530,14 +530,14 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx,
 		return ret;
 	}
 
-	ret = aim_register_videodev(mdev);
+	ret = comp_register_videodev(mdev);
 	if (ret)
 		goto err_unreg;
 
 	spin_lock_irq(&list_lock);
 	list_add(&mdev->list, &video_devices);
 	spin_unlock_irq(&list_lock);
-	v4l2_info(&mdev->v4l2_dev, "aim_probe_channel() done\n");
+	v4l2_info(&mdev->v4l2_dev, "comp_probe_channel() done\n");
 	return 0;
 
 err_unreg:
@@ -546,42 +546,42 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx,
 	return ret;
 }
 
-static int aim_disconnect_channel(struct most_interface *iface,
+static int comp_disconnect_channel(struct most_interface *iface,
 				  int channel_idx)
 {
-	struct most_video_dev *mdev = get_aim_dev(iface, channel_idx);
+	struct most_video_dev *mdev = get_comp_dev(iface, channel_idx);
 
 	if (!mdev) {
 		pr_err("no such channel is linked\n");
 		return -ENOENT;
 	}
 
-	v4l2_info(&mdev->v4l2_dev, "aim_disconnect_channel()\n");
+	v4l2_info(&mdev->v4l2_dev, "comp_disconnect_channel()\n");
 
 	spin_lock_irq(&list_lock);
 	list_del(&mdev->list);
 	spin_unlock_irq(&list_lock);
 
-	aim_unregister_videodev(mdev);
+	comp_unregister_videodev(mdev);
 	v4l2_device_disconnect(&mdev->v4l2_dev);
 	v4l2_device_put(&mdev->v4l2_dev);
 	return 0;
 }
 
-static struct core_component aim_info = {
-	.name = "v4l",
-	.probe_channel = aim_probe_channel,
-	.disconnect_channel = aim_disconnect_channel,
-	.rx_completion = aim_rx_data,
+static struct core_component comp_info = {
+	.name = "video",
+	.probe_channel = comp_probe_channel,
+	.disconnect_channel = comp_disconnect_channel,
+	.rx_completion = comp_rx_data,
 };
 
-static int __init aim_init(void)
+static int __init comp_init(void)
 {
 	spin_lock_init(&list_lock);
-	return most_register_component(&aim_info);
+	return most_register_component(&comp);
 }
 
-static void __exit aim_exit(void)
+static void __exit comp_exit(void)
 {
 	struct most_video_dev *mdev, *tmp;
 
@@ -596,20 +596,20 @@ static void __exit aim_exit(void)
 		list_del(&mdev->list);
 		spin_unlock_irq(&list_lock);
 
-		aim_unregister_videodev(mdev);
+		comp_unregister_videodev(mdev);
 		v4l2_device_disconnect(&mdev->v4l2_dev);
 		v4l2_device_put(&mdev->v4l2_dev);
 		spin_lock_irq(&list_lock);
 	}
 	spin_unlock_irq(&list_lock);
 
-	most_deregister_component(&aim_info);
+	most_deregister_component(&comp_info);
 	BUG_ON(!list_empty(&video_devices));
 }
 
-module_init(aim_init);
-module_exit(aim_exit);
+module_init(comp_init);
+module_exit(comp_exit);
 
-MODULE_DESCRIPTION("V4L2 Application Interface Module for MostCore");
+MODULE_DESCRIPTION("V4L2 Component Module for MostCore");
 MODULE_AUTHOR("Andrey Shvetsov <andrey.shvetsov@k2l.de>");
 MODULE_LICENSE("GPL");
-- 
2.7.4

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

* [PATCH 34/50] staging: most: cdev: rename struct aim_channel
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (32 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 33/50] staging: most: video: remove aim designators Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 35/50] staging: most: cdev: rename variable aim_devno Christian Gromm
                   ` (17 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the structure aim_channel to comp_channel. It is needed
to complete the process of changing the module designator from AIM to
Component.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/cdev/cdev.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c
index 5f8f003..2008a38 100644
--- a/drivers/staging/most/cdev/cdev.c
+++ b/drivers/staging/most/cdev/cdev.c
@@ -30,7 +30,7 @@ static struct ida minor_id;
 static unsigned int major;
 static struct core_component cdev_aim;
 
-struct aim_channel {
+struct comp_channel {
 	wait_queue_head_t wq;
 	spinlock_t unlink;	/* synchronization lock to unlink channels */
 	struct cdev cdev;
@@ -46,16 +46,16 @@ struct aim_channel {
 	struct list_head list;
 };
 
-#define to_channel(d) container_of(d, struct aim_channel, cdev)
+#define to_channel(d) container_of(d, struct comp_channel, cdev)
 static struct list_head channel_list;
 static spinlock_t ch_list_lock;
 
-static inline bool ch_has_mbo(struct aim_channel *c)
+static inline bool ch_has_mbo(struct comp_channel *c)
 {
 	return channel_has_mbo(c->iface, c->channel_id, &cdev_aim) > 0;
 }
 
-static inline bool ch_get_mbo(struct aim_channel *c, struct mbo **mbo)
+static inline bool ch_get_mbo(struct comp_channel *c, struct mbo **mbo)
 {
 	if (!kfifo_peek(&c->fifo, mbo)) {
 		*mbo = most_get_mbo(c->iface, c->channel_id, &cdev_aim);
@@ -65,9 +65,9 @@ static inline bool ch_get_mbo(struct aim_channel *c, struct mbo **mbo)
 	return *mbo;
 }
 
-static struct aim_channel *get_channel(struct most_interface *iface, int id)
+static struct comp_channel *get_channel(struct most_interface *iface, int id)
 {
-	struct aim_channel *c, *tmp;
+	struct comp_channel *c, *tmp;
 	unsigned long flags;
 	int found_channel = 0;
 
@@ -84,7 +84,7 @@ static struct aim_channel *get_channel(struct most_interface *iface, int id)
 	return c;
 }
 
-static void stop_channel(struct aim_channel *c)
+static void stop_channel(struct comp_channel *c)
 {
 	struct mbo *mbo;
 
@@ -93,7 +93,7 @@ static void stop_channel(struct aim_channel *c)
 	most_stop_channel(c->iface, c->channel_id, &cdev_aim);
 }
 
-static void destroy_cdev(struct aim_channel *c)
+static void destroy_cdev(struct comp_channel *c)
 {
 	unsigned long flags;
 
@@ -104,7 +104,7 @@ static void destroy_cdev(struct aim_channel *c)
 	spin_unlock_irqrestore(&ch_list_lock, flags);
 }
 
-static void destroy_channel(struct aim_channel *c)
+static void destroy_channel(struct comp_channel *c)
 {
 	ida_simple_remove(&minor_id, MINOR(c->devno));
 	kfifo_free(&c->fifo);
@@ -121,7 +121,7 @@ static void destroy_channel(struct aim_channel *c)
  */
 static int aim_open(struct inode *inode, struct file *filp)
 {
-	struct aim_channel *c;
+	struct comp_channel *c;
 	int ret;
 
 	c = to_channel(inode->i_cdev);
@@ -165,7 +165,7 @@ static int aim_open(struct inode *inode, struct file *filp)
  */
 static int aim_close(struct inode *inode, struct file *filp)
 {
-	struct aim_channel *c = to_channel(inode->i_cdev);
+	struct comp_channel *c = to_channel(inode->i_cdev);
 
 	mutex_lock(&c->io_mutex);
 	spin_lock(&c->unlink);
@@ -194,7 +194,7 @@ static ssize_t aim_write(struct file *filp, const char __user *buf,
 	int ret;
 	size_t to_copy, left;
 	struct mbo *mbo = NULL;
-	struct aim_channel *c = filp->private_data;
+	struct comp_channel *c = filp->private_data;
 
 	mutex_lock(&c->io_mutex);
 	while (c->dev && !ch_get_mbo(c, &mbo)) {
@@ -247,7 +247,7 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset)
 {
 	size_t to_copy, not_copied, copied;
 	struct mbo *mbo;
-	struct aim_channel *c = filp->private_data;
+	struct comp_channel *c = filp->private_data;
 
 	mutex_lock(&c->io_mutex);
 	while (c->dev && !kfifo_peek(&c->fifo, &mbo)) {
@@ -289,7 +289,7 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset)
 
 static unsigned int aim_poll(struct file *filp, poll_table *wait)
 {
-	struct aim_channel *c = filp->private_data;
+	struct comp_channel *c = filp->private_data;
 	unsigned int mask = 0;
 
 	poll_wait(filp, &c->wq, wait);
@@ -326,7 +326,7 @@ static const struct file_operations channel_fops = {
  */
 static int aim_disconnect_channel(struct most_interface *iface, int channel_id)
 {
-	struct aim_channel *c;
+	struct comp_channel *c;
 
 	if (!iface) {
 		pr_info("Bad interface pointer\n");
@@ -362,7 +362,7 @@ static int aim_disconnect_channel(struct most_interface *iface, int channel_id)
  */
 static int aim_rx_completion(struct mbo *mbo)
 {
-	struct aim_channel *c;
+	struct comp_channel *c;
 
 	if (!mbo)
 		return -EINVAL;
@@ -395,7 +395,7 @@ static int aim_rx_completion(struct mbo *mbo)
  */
 static int aim_tx_completion(struct most_interface *iface, int channel_id)
 {
-	struct aim_channel *c;
+	struct comp_channel *c;
 
 	if (!iface) {
 		pr_info("Bad interface pointer\n");
@@ -427,7 +427,7 @@ static int aim_tx_completion(struct most_interface *iface, int channel_id)
 static int aim_probe(struct most_interface *iface, int channel_id,
 		     struct most_channel_config *cfg, char *name)
 {
-	struct aim_channel *c;
+	struct comp_channel *c;
 	unsigned long cl_flags;
 	int retval;
 	int current_minor;
@@ -540,7 +540,7 @@ static int __init mod_init(void)
 
 static void __exit mod_exit(void)
 {
-	struct aim_channel *c, *tmp;
+	struct comp_channel *c, *tmp;
 
 	pr_info("exit module\n");
 
-- 
2.7.4

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

* [PATCH 35/50] staging: most: cdev: rename variable aim_devno
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (33 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 34/50] staging: most: cdev: rename struct aim_channel Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 36/50] staging: most: cdev: rename class instance aim_class Christian Gromm
                   ` (16 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the variable aim_devno to comp_devno. It is needed
to complete the process of changing the module designator from AIM to
Component.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/cdev/cdev.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c
index 2008a38..5c6d0ae 100644
--- a/drivers/staging/most/cdev/cdev.c
+++ b/drivers/staging/most/cdev/cdev.c
@@ -24,7 +24,7 @@
 #include <linux/idr.h>
 #include "most/core.h"
 
-static dev_t aim_devno;
+static dev_t comp_devno;
 static struct class *aim_class;
 static struct ida minor_id;
 static unsigned int major;
@@ -513,10 +513,10 @@ static int __init mod_init(void)
 	spin_lock_init(&ch_list_lock);
 	ida_init(&minor_id);
 
-	err = alloc_chrdev_region(&aim_devno, 0, 50, "cdev");
+	err = alloc_chrdev_region(&comp_devno, 0, 50, "cdev");
 	if (err < 0)
 		goto dest_ida;
-	major = MAJOR(aim_devno);
+	major = MAJOR(comp_devno);
 
 	aim_class = class_create(THIS_MODULE, "most_cdev_aim");
 	if (IS_ERR(aim_class)) {
@@ -532,7 +532,7 @@ static int __init mod_init(void)
 dest_class:
 	class_destroy(aim_class);
 free_cdev:
-	unregister_chrdev_region(aim_devno, 1);
+	unregister_chrdev_region(comp_devno, 1);
 dest_ida:
 	ida_destroy(&minor_id);
 	return err;
@@ -551,7 +551,7 @@ static void __exit mod_exit(void)
 		destroy_channel(c);
 	}
 	class_destroy(aim_class);
-	unregister_chrdev_region(aim_devno, 1);
+	unregister_chrdev_region(comp_devno, 1);
 	ida_destroy(&minor_id);
 }
 
-- 
2.7.4

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

* [PATCH 36/50] staging: most: cdev: rename class instance aim_class
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (34 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 35/50] staging: most: cdev: rename variable aim_devno Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 37/50] staging: most: cdev: rename variable cdev_aim Christian Gromm
                   ` (15 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the instance  aim_class of struct class to comp_class.
It is needed to complete the process of changing the module designator from
AIM to Component.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/cdev/cdev.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c
index 5c6d0ae..e47d6aa 100644
--- a/drivers/staging/most/cdev/cdev.c
+++ b/drivers/staging/most/cdev/cdev.c
@@ -25,7 +25,7 @@
 #include "most/core.h"
 
 static dev_t comp_devno;
-static struct class *aim_class;
+static struct class *comp_class;
 static struct ida minor_id;
 static unsigned int major;
 static struct core_component cdev_aim;
@@ -97,7 +97,7 @@ static void destroy_cdev(struct comp_channel *c)
 {
 	unsigned long flags;
 
-	device_destroy(aim_class, c->devno);
+	device_destroy(comp_class, c->devno);
 	cdev_del(&c->cdev);
 	spin_lock_irqsave(&ch_list_lock, flags);
 	list_del(&c->list);
@@ -470,7 +470,7 @@ static int aim_probe(struct most_interface *iface, int channel_id,
 	spin_lock_irqsave(&ch_list_lock, cl_flags);
 	list_add_tail(&c->list, &channel_list);
 	spin_unlock_irqrestore(&ch_list_lock, cl_flags);
-	c->dev = device_create(aim_class,
+	c->dev = device_create(comp_class,
 				     NULL,
 				     c->devno,
 				     NULL,
@@ -518,10 +518,10 @@ static int __init mod_init(void)
 		goto dest_ida;
 	major = MAJOR(comp_devno);
 
-	aim_class = class_create(THIS_MODULE, "most_cdev_aim");
-	if (IS_ERR(aim_class)) {
+	comp_class = class_create(THIS_MODULE, "most_cdev_aim");
+	if (IS_ERR(comp_class)) {
 		pr_err("no udev support\n");
-		err = PTR_ERR(aim_class);
+		err = PTR_ERR(comp_class);
 		goto free_cdev;
 	}
 	err = most_register_component(&cdev_aim);
@@ -530,7 +530,7 @@ static int __init mod_init(void)
 	return 0;
 
 dest_class:
-	class_destroy(aim_class);
+	class_destroy(comp_class);
 free_cdev:
 	unregister_chrdev_region(comp_devno, 1);
 dest_ida:
@@ -550,7 +550,7 @@ static void __exit mod_exit(void)
 		destroy_cdev(c);
 		destroy_channel(c);
 	}
-	class_destroy(aim_class);
+	class_destroy(comp_class);
 	unregister_chrdev_region(comp_devno, 1);
 	ida_destroy(&minor_id);
 }
-- 
2.7.4

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

* [PATCH 37/50] staging: most: cdev: rename variable cdev_aim
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (35 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 36/50] staging: most: cdev: rename class instance aim_class Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 38/50] staging: most: fix comment sections Christian Gromm
                   ` (14 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the variable cdev_aim to cdev_comp. It is needed to
complete the process of changing the module designator from AIM to
Component.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/cdev/cdev.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c
index e47d6aa..c741231 100644
--- a/drivers/staging/most/cdev/cdev.c
+++ b/drivers/staging/most/cdev/cdev.c
@@ -28,7 +28,7 @@ static dev_t comp_devno;
 static struct class *comp_class;
 static struct ida minor_id;
 static unsigned int major;
-static struct core_component cdev_aim;
+static struct core_component cdev_comp;
 
 struct comp_channel {
 	wait_queue_head_t wq;
@@ -52,13 +52,13 @@ static spinlock_t ch_list_lock;
 
 static inline bool ch_has_mbo(struct comp_channel *c)
 {
-	return channel_has_mbo(c->iface, c->channel_id, &cdev_aim) > 0;
+	return channel_has_mbo(c->iface, c->channel_id, &cdev_comp) > 0;
 }
 
 static inline bool ch_get_mbo(struct comp_channel *c, struct mbo **mbo)
 {
 	if (!kfifo_peek(&c->fifo, mbo)) {
-		*mbo = most_get_mbo(c->iface, c->channel_id, &cdev_aim);
+		*mbo = most_get_mbo(c->iface, c->channel_id, &cdev_comp);
 		if (*mbo)
 			kfifo_in(&c->fifo, mbo, 1);
 	}
@@ -90,7 +90,7 @@ static void stop_channel(struct comp_channel *c)
 
 	while (kfifo_out((struct kfifo *)&c->fifo, &mbo, 1))
 		most_put_mbo(mbo);
-	most_stop_channel(c->iface, c->channel_id, &cdev_aim);
+	most_stop_channel(c->iface, c->channel_id, &cdev_comp);
 }
 
 static void destroy_cdev(struct comp_channel *c)
@@ -149,7 +149,7 @@ static int aim_open(struct inode *inode, struct file *filp)
 	}
 
 	c->mbo_offs = 0;
-	ret = most_start_channel(c->iface, c->channel_id, &cdev_aim);
+	ret = most_start_channel(c->iface, c->channel_id, &cdev_comp);
 	if (!ret)
 		c->access_ref = 1;
 	mutex_unlock(&c->io_mutex);
@@ -495,7 +495,7 @@ static int aim_probe(struct most_interface *iface, int channel_id,
 	return retval;
 }
 
-static struct core_component cdev_aim = {
+static struct core_component cdev_comp = {
 	.name = "cdev",
 	.probe_channel = aim_probe,
 	.disconnect_channel = aim_disconnect_channel,
@@ -518,13 +518,13 @@ static int __init mod_init(void)
 		goto dest_ida;
 	major = MAJOR(comp_devno);
 
-	comp_class = class_create(THIS_MODULE, "most_cdev_aim");
+	comp_class = class_create(THIS_MODULE, "most_cdev_comp");
 	if (IS_ERR(comp_class)) {
 		pr_err("no udev support\n");
 		err = PTR_ERR(comp_class);
 		goto free_cdev;
 	}
-	err = most_register_component(&cdev_aim);
+	err = most_register_component(&cdev_comp);
 	if (err)
 		goto dest_class;
 	return 0;
@@ -544,7 +544,7 @@ static void __exit mod_exit(void)
 
 	pr_info("exit module\n");
 
-	most_deregister_component(&cdev_aim);
+	most_deregister_component(&cdev_comp);
 
 	list_for_each_entry_safe(c, tmp, &channel_list, list) {
 		destroy_cdev(c);
-- 
2.7.4

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

* [PATCH 38/50] staging: most: fix comment sections
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (36 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 37/50] staging: most: cdev: rename variable cdev_aim Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 39/50] staging: most: core: denote modules as components Christian Gromm
                   ` (13 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch updates and corrects the comment sections of the code.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/cdev/cdev.c   |   4 +-
 drivers/staging/most/core.c        | 108 ++++++++++++++++---------------------
 drivers/staging/most/core.h        |  39 ++++++--------
 drivers/staging/most/net/net.c     |   4 +-
 drivers/staging/most/sound/sound.c |   2 +-
 drivers/staging/most/video/video.c |   4 +-
 6 files changed, 70 insertions(+), 91 deletions(-)

diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c
index c741231..225369d 100644
--- a/drivers/staging/most/cdev/cdev.c
+++ b/drivers/staging/most/cdev/cdev.c
@@ -1,5 +1,5 @@
 /*
- * cdev.c - Application interfacing module for character devices
+ * cdev.c - Character device component for Mostcore
  *
  * Copyright (C) 2013-2015 Microchip Technology Germany II GmbH & Co. KG
  *
@@ -559,4 +559,4 @@ module_init(mod_init);
 module_exit(mod_exit);
 MODULE_AUTHOR("Christian Gromm <christian.gromm@microchip.com>");
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("character device AIM for mostcore");
+MODULE_DESCRIPTION("character device component for mostcore");
diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 6d7fe7d..d490bdc 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -109,14 +109,9 @@ static const struct {
 	_mbo;								\
 })
 
-/*		     ___	     ___
- *		     ___C H A N N E L___
- */
-
 /**
  * most_free_mbo_coherent - free an MBO and its coherent buffer
- * @mbo: buffer to be released
- *
+ * @mbo: most buffer
  */
 static void most_free_mbo_coherent(struct mbo *mbo)
 {
@@ -475,9 +470,6 @@ static const struct attribute_group *channel_attr_groups[] = {
 	NULL,
 };
 
-/*		     ___	       ___
- *		     ___I N S T A N C E___
- */
 static ssize_t description_show(struct device *dev,
 				struct device_attribute *attr,
 				char *buf)
@@ -534,9 +526,6 @@ static const struct attribute_group *interface_attr_groups[] = {
 	NULL,
 };
 
-/*		     ___     ___
- *		     ___A I M___
- */
 static struct core_component *match_module(char *name)
 {
 	struct core_component *comp;
@@ -594,26 +583,26 @@ static ssize_t modules_show(struct device_driver *drv, char *buf)
 	return offs;
 }
 /**
- * split_string - parses and changes string in the buffer buf and
- * splits it into two mandatory and one optional substrings.
+ * split_string - parses buf and extracts ':' separated substrings.
  *
  * @buf: complete string from attribute 'add_channel'
- * @a: address of pointer to 1st substring (=instance name)
- * @b: address of pointer to 2nd substring (=channel name)
- * @c: optional address of pointer to 3rd substring (=user defined name)
+ * @a: storage for 1st substring (=interface name)
+ * @b: storage for 2nd substring (=channel name)
+ * @c: storage for 3rd substring (=component name)
+ * @d: storage optional 4th substring (=user defined name)
  *
  * Examples:
  *
- * Input: "mdev0:ch6:my_channel\n" or
- *        "mdev0:ch6:my_channel"
+ * Input: "mdev0:ch6:cdev:my_channel\n" or
+ *        "mdev0:ch6:cdev:my_channel"
  *
- * Output: *a -> "mdev0", *b -> "ch6", *c -> "my_channel"
+ * Output: *a -> "mdev0", *b -> "ch6", *c -> "cdev" *d -> "my_channel"
  *
- * Input: "mdev1:ep81\n"
- * Output: *a -> "mdev1", *b -> "ep81", *c -> ""
+ * Input: "mdev1:ep81:cdev\n"
+ * Output: *a -> "mdev1", *b -> "ep81", *c -> "cdev" *d -> ""
  *
  * Input: "mdev1:ep81"
- * Output: *a -> "mdev1", *b -> "ep81", *c == NULL
+ * Output: *a -> "mdev1", *b -> "ep81", *c -> "cdev" *d == NULL
  */
 static int split_string(char *buf, char **a, char **b, char **c, char **d)
 {
@@ -643,11 +632,9 @@ static int match_bus_dev(struct device *dev, void *data)
 }
 
 /**
- * get_channel - get pointer to channel object
- * @mdev: name of the device instance
- * @mdev_ch: name of the respective channel
- *
- * This retrieves the pointer to a channel object.
+ * get_channel - get pointer to channel
+ * @mdev: name of the device interface
+ * @mdev_ch: name of channel
  */
 static struct most_channel *get_channel(char *mdev, char *mdev_ch)
 {
@@ -693,23 +680,22 @@ inline int link_channel_to_component(struct most_channel *c,
 }
 
 /**
- * add_link_store - store() function for add_link attribute
- * @aim_obj: pointer to AIM object
- * @attr: its attributes
+ * add_link_store - store function for add_link attribute
+ * @drv: device driver
  * @buf: buffer
  * @len: buffer length
  *
  * This parses the string given by buf and splits it into
- * three substrings. Note: third substring is optional. In case a cdev
- * AIM is loaded the optional 3rd substring will make up the name of
+ * four substrings. Note: last substring is optional. In case a cdev
+ * component is loaded the optional 4th substring will make up the name of
  * device node in the /dev directory. If omitted, the device node will
  * inherit the channel's name within sysfs.
  *
- * Searches for a pair of device and channel and probes the AIM
+ * Searches for (device, channel) pair and probes the component
  *
  * Example:
- * (1) echo "mdev0:ch6:my_rxchannel" >add_link
- * (2) echo "mdev1:ep81" >add_link
+ * (1) echo "mdev0:ch6:cdev:my_rxchannel" >add_link
+ * (2) echo "mdev1:ep81:cdev" >add_link
  *
  * (1) would create the device node /dev/my_rxchannel
  * (2) would create the device node /dev/mdev1-ep81
@@ -754,8 +740,7 @@ static ssize_t add_link_store(struct device_driver *drv,
 
 /**
  * remove_link_store - store function for remove_link attribute
- * @aim_obj: pointer to AIM object
- * @attr: its attributes
+ * @drv: device driver
  * @buf: buffer
  * @len: buffer length
  *
@@ -817,10 +802,6 @@ static const struct attribute_group *module_attr_groups[] = {
 	NULL,
 };
 
-/*		     ___       ___
- *		     ___C O R E___
- */
-
 int most_match(struct device *dev, struct device_driver *drv)
 {
 	if (!strcmp(dev_name(dev), "most"))
@@ -919,14 +900,14 @@ static int run_enqueue_thread(struct most_channel *c, int channel_id)
 
 /**
  * arm_mbo - recycle MBO for further usage
- * @mbo: buffer object
+ * @mbo: most buffer
  *
  * This puts an MBO back to the list to have it ready for up coming
  * tx transactions.
  *
  * In case the MBO belongs to a channel that recently has been
  * poisoned, the MBO is scheduled to be trashed.
- * Calls the completion handler of an attached AIM.
+ * Calls the completion handler of an attached component.
  */
 static void arm_mbo(struct mbo *mbo)
 {
@@ -1013,7 +994,7 @@ static int arm_mbo_chain(struct most_channel *c, int dir,
 
 /**
  * most_submit_mbo - submits an MBO to fifo
- * @mbo: pointer to the MBO
+ * @mbo: most buffer
  */
 void most_submit_mbo(struct mbo *mbo)
 {
@@ -1027,7 +1008,7 @@ EXPORT_SYMBOL_GPL(most_submit_mbo);
 
 /**
  * most_write_completion - write completion handler
- * @mbo: pointer to MBO
+ * @mbo: most buffer
  *
  * This recycles the MBO for further usage. In case the channel has been
  * poisoned, the MBO is scheduled to be trashed.
@@ -1073,6 +1054,7 @@ EXPORT_SYMBOL_GPL(channel_has_mbo);
  * most_get_mbo - get pointer to an MBO of pool
  * @iface: pointer to interface instance
  * @id: channel ID
+ * @comp: driver component
  *
  * This attempts to get a free buffer out of the channel fifo.
  * Returns a pointer to MBO on success or NULL otherwise.
@@ -1118,7 +1100,7 @@ EXPORT_SYMBOL_GPL(most_get_mbo);
 
 /**
  * most_put_mbo - return buffer to pool
- * @mbo: buffer object
+ * @mbo: most buffer
  */
 void most_put_mbo(struct mbo *mbo)
 {
@@ -1135,13 +1117,13 @@ EXPORT_SYMBOL_GPL(most_put_mbo);
 
 /**
  * most_read_completion - read completion handler
- * @mbo: pointer to MBO
+ * @mbo: most buffer
  *
  * This function is called by the HDM when data has been received from the
  * hardware and copied to the buffer of the MBO.
  *
  * In case the channel has been poisoned it puts the buffer in the trash queue.
- * Otherwise, it passes the buffer to an AIM for further processing.
+ * Otherwise, it passes the buffer to an component for further processing.
  */
 static void most_read_completion(struct mbo *mbo)
 {
@@ -1176,6 +1158,7 @@ static void most_read_completion(struct mbo *mbo)
  * most_start_channel - prepares a channel for communication
  * @iface: pointer to interface instance
  * @id: channel ID
+ * @comp: driver component
  *
  * This prepares the channel for usage. Cross-checks whether the
  * channel's been properly configured.
@@ -1194,7 +1177,7 @@ int most_start_channel(struct most_interface *iface, int id,
 
 	mutex_lock(&c->start_mutex);
 	if (c->pipe0.refs + c->pipe1.refs > 0)
-		goto out; /* already started by other comp */
+		goto out; /* already started by another component */
 
 	if (!try_module_get(iface->mod)) {
 		pr_info("failed to acquire HDM lock\n");
@@ -1251,6 +1234,7 @@ EXPORT_SYMBOL_GPL(most_start_channel);
  * most_stop_channel - stops a running channel
  * @iface: pointer to interface instance
  * @id: channel ID
+ * @comp: driver component
  */
 int most_stop_channel(struct most_interface *iface, int id,
 		      struct core_component *comp)
@@ -1308,17 +1292,17 @@ int most_stop_channel(struct most_interface *iface, int id,
 EXPORT_SYMBOL_GPL(most_stop_channel);
 
 /**
- * most_register_component - registers an AIM (driver) with the core
- * @aim: instance of AIM to be registered
+ * most_register_component - registers a driver component with the core
+ * @comp: driver component
  */
 int most_register_component(struct core_component *comp)
 {
 	if (!comp) {
-		pr_err("Bad driver\n");
+		pr_err("Bad component\n");
 		return -EINVAL;
 	}
 	list_add_tail(&comp->list, &mc.comp_list);
-	pr_info("registered new application interfacing module %s\n", comp->name);
+	pr_info("registered new core component %s\n", comp->name);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(most_register_component);
@@ -1342,19 +1326,19 @@ static int disconnect_channels(struct device *dev, void *data)
 }
 
 /**
- * most_deregister_component - deregisters an AIM (driver) with the core
- * @aim: AIM to be removed
+ * most_deregister_component - deregisters a driver component with the core
+ * @comp: driver component
  */
 int most_deregister_component(struct core_component *comp)
 {
 	if (!comp) {
-		pr_err("Bad driver\n");
+		pr_err("Bad component\n");
 		return -EINVAL;
 	}
 
 	bus_for_each_dev(&mc.bus, NULL, comp, disconnect_channels);
 	list_del(&comp->list);
-	pr_info("deregistering module %s\n", comp->name);
+	pr_info("deregistering component %s\n", comp->name);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(most_deregister_component);
@@ -1371,7 +1355,7 @@ static void release_channel(struct device *dev)
 
 /**
  * most_register_interface - registers an interface with core
- * @iface: pointer to the instance of the interface description.
+ * @iface: device interface
  *
  * Allocates and initializes a new interface instance and all of its channels.
  * Returns a pointer to kobject or an error pointer.
@@ -1457,7 +1441,7 @@ int most_register_interface(struct most_interface *iface)
 		mutex_init(&c->nq_mutex);
 		list_add_tail(&c->list, &iface->p->channel_list);
 	}
-	pr_info("registered new MOST device mdev%d (%s)\n",
+	pr_info("registered new device mdev%d (%s)\n",
 		id, iface->description);
 	return 0;
 
@@ -1479,7 +1463,7 @@ EXPORT_SYMBOL_GPL(most_register_interface);
 
 /**
  * most_deregister_interface - deregisters an interface with core
- * @iface: pointer to the interface instance description.
+ * @iface: device interface
  *
  * Before removing an interface instance from the list, all running
  * channels are stopped and poisoned.
@@ -1489,7 +1473,7 @@ void most_deregister_interface(struct most_interface *iface)
 	int i;
 	struct most_channel *c;
 
-	pr_info("deregistering MOST device %s (%s)\n", dev_name(&iface->dev), iface->description);
+	pr_info("deregistering device %s (%s)\n", dev_name(&iface->dev), iface->description);
 	for (i = 0; i < iface->num_channels; i++) {
 		c = iface->p->channel[i];
 		if (c->pipe0.comp)
diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h
index 3c2975b..d6e9b87 100644
--- a/drivers/staging/most/core.h
+++ b/drivers/staging/most/core.h
@@ -1,6 +1,5 @@
 /*
- * most.h - Interface between MostCore,
- *   Hardware Dependent Module (HDM) and Application Interface Module (AIM).
+ * most.h - API for component and adapter drivers
  *
  * Copyright (C) 2013-2015, Microchip Technology Germany II GmbH & Co. KG
  *
@@ -12,13 +11,6 @@
  * This file is licensed under GPLv2.
  */
 
-/*
- * Authors:
- *   Andrey Shvetsov <andrey.shvetsov@k2l.de>
- *   Christian Gromm <christian.gromm@microchip.com>
- *   Sebastian Graf
- */
-
 #ifndef __MOST_CORE_H__
 #define __MOST_CORE_H__
 
@@ -80,22 +72,22 @@ enum mbo_status_flags {
  * The value is bitwise OR-combination of the values from the
  * enumeration most_channel_data_type. Zero is allowed value and means
  * "channel may not be used".
- * @num_buffer_packet: Maximum number of buffers supported by this channel
+ * @num_buffers_packet: Maximum number of buffers supported by this channel
  * for packet data types (Async,Control,QoS)
  * @buffer_size_packet: Maximum buffer size supported by this channel
  * for packet data types (Async,Control,QoS)
- * @num_buffer_streaming: Maximum number of buffers supported by this channel
+ * @num_buffers_streaming: Maximum number of buffers supported by this channel
  * for streaming data types (Sync,AV Packetized)
  * @buffer_size_streaming: Maximum buffer size supported by this channel
  * for streaming data types (Sync,AV Packetized)
  * @name_suffix: Optional suffix providean by an HDM that is attached to the
  * regular channel name.
  *
- * Describes the capabilities of a MostCore channel like supported Data Types
+ * Describes the capabilities of a MOST channel like supported Data Types
  * and directions. This information is provided by an HDM for the MostCore.
  *
  * The Core creates read only sysfs attribute files in
- * /sys/devices/virtual/most/mostcore/devices/mdev-#/mdev#-ch#/ with the
+ * /sys/devices/most/mdev#/<channel>/ with the
  * following attributes:
  *	-available_directions
  *	-available_datatypes
@@ -130,7 +122,7 @@ struct most_channel_capability {
  * @packets_per_xact: number of MOST frames that are packet inside one USB
  *		      packet. This is USB specific
  *
- * Describes the configuration for a MostCore channel. This information is
+ * Describes the configuration for a MOST channel. This information is
  * provided from the MostCore to a HDM (like the Medusa PCIe Interface) as a
  * parameter of the "configure" function call.
  */
@@ -154,6 +146,7 @@ struct most_channel_config {
  *
  * @list: list head for use by the mbo's current owner
  * @ifp: (in) associated interface instance
+ * @num_buffers_ptr: amount of pool buffers
  * @hdm_channel_id: (in) HDM channel instance
  * @virt_address: (in) kernel virtual address of the buffer
  * @bus_address: (in) bus address of the buffer
@@ -162,15 +155,15 @@ struct most_channel_config {
  * @status: (out) transfer status
  * @complete: (in) completion routine
  *
- * The MostCore allocates and initializes the MBO.
+ * The core allocates and initializes the MBO.
  *
- * The HDM receives MBO for transfer from MostCore with the call to enqueue().
+ * The HDM receives MBO for transfer from the core with the call to enqueue().
  * The HDM copies the data to- or from the buffer depending on configured
  * channel direction, set "processed_length" and "status" and completes
  * the transfer procedure by calling the completion routine.
  *
- * At the end the MostCore deallocates the MBO or recycles it for further
- * transfers for the same or different HDM.
+ * Finally, the MBO is being deallocated or recycled for further
+ * transfers of the same or a different HDM.
  *
  * Directions of usage:
  * The core driver should never access any MBO fields (even if marked
@@ -203,10 +196,12 @@ struct mbo {
 /**
  * Interface instance description.
  *
- * Describes one instance of an interface like Medusa PCIe or Vantage USB.
+ * Describes an interface of a MOST device the core driver is bound to.
  * This structure is allocated and initialized in the HDM. MostCore may not
  * modify this structure.
  *
+ * @dev: the actual device
+ * @mod: module
  * @interface Interface type. \sa most_interface_type.
  * @description PRELIMINARY.
  *   Unique description of the device instance from point of view of the
@@ -261,13 +256,13 @@ struct most_interface {
 #define to_most_interface(d) container_of(d, struct most_interface, dev)
 
 /**
- * struct most_aim - identifies MOST device driver to mostcore
- * @name: Driver name
+ * struct core_component - identifies a loadable component for the mostcore
+ * @list: list_head
+ * @name: component name
  * @probe_channel: function for core to notify driver about channel connection
  * @disconnect_channel: callback function to disconnect a certain channel
  * @rx_completion: completion handler for received packets
  * @tx_completion: completion handler for transmitted packets
- * @context: context pointer to be used by mostcore
  */
 struct core_component {
 	struct list_head list;
diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c
index 00a5ddf..27cd31b 100644
--- a/drivers/staging/most/net/net.c
+++ b/drivers/staging/most/net/net.c
@@ -1,5 +1,5 @@
 /*
- * Networking component - Networking Application Interface Module for MostCore
+ * net.c - Networking component for Mostcore
  *
  * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG
  *
@@ -563,4 +563,4 @@ module_init(most_net_init);
 module_exit(most_net_exit);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Andrey Shvetsov <andrey.shvetsov@k2l.de>");
-MODULE_DESCRIPTION("Networking Application Interface Module for MostCore");
+MODULE_DESCRIPTION("Networking Component Module for Mostcore");
diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c
index 2c9e6c9..21231e3 100644
--- a/drivers/staging/most/sound/sound.c
+++ b/drivers/staging/most/sound/sound.c
@@ -761,4 +761,4 @@ module_exit(audio_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Christian Gromm <christian.gromm@microchip.com>");
-MODULE_DESCRIPTION("Audio Application Interface Module for MostCore");
+MODULE_DESCRIPTION("Sound Component Module for Mostcore");
diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
index b06488b..1577f36 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -1,5 +1,5 @@
 /*
- * V4L2 Component - V4L2 Application Interface Module for MostCore
+ * video.c - V4L2 component for Mostcore
  *
  * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG
  *
@@ -610,6 +610,6 @@ static void __exit comp_exit(void)
 module_init(comp_init);
 module_exit(comp_exit);
 
-MODULE_DESCRIPTION("V4L2 Component Module for MostCore");
+MODULE_DESCRIPTION("V4L2 Component Module for Mostcore");
 MODULE_AUTHOR("Andrey Shvetsov <andrey.shvetsov@k2l.de>");
 MODULE_LICENSE("GPL");
-- 
2.7.4

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

* [PATCH 39/50] staging: most: core: denote modules as components
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (37 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 38/50] staging: most: fix comment sections Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 40/50] staging: most: core: fix formatting Christian Gromm
                   ` (12 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

Substrings containing 'module' are replaced with 'component' by this patch.
It is needed to complete the process of changing the module designator from
AIM to Component.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index d490bdc..b0e9179 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -526,7 +526,7 @@ static const struct attribute_group *interface_attr_groups[] = {
 	NULL,
 };
 
-static struct core_component *match_module(char *name)
+static struct core_component *match_component(char *name)
 {
 	struct core_component *comp;
 
@@ -571,7 +571,7 @@ static ssize_t links_show(struct device_driver *drv, char *buf)
 	return strlen(buf);
 }
 
-static ssize_t modules_show(struct device_driver *drv, char *buf)
+static ssize_t components_show(struct device_driver *drv, char *buf)
 {
 	struct core_component *comp;
 	int offs = 0;
@@ -720,7 +720,7 @@ static ssize_t add_link_store(struct device_driver *drv,
 	ret = split_string(buffer, &mdev, &mdev_ch, &comp_name, &comp_param);
 	if (ret)
 		return ret;
-	comp = match_module(comp_name);
+	comp = match_component(comp_name);
 	if (!comp_param || *comp_param == 0) {
 		snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev,
 			 mdev_ch);
@@ -764,7 +764,7 @@ static ssize_t remove_link_store(struct device_driver *drv,
 	ret = split_string(buffer, &mdev, &mdev_ch, &comp_name, NULL);
 	if (ret)
 		return ret;
-	comp = match_module(comp_name);
+	comp = match_component(comp_name);
 	c = get_channel(mdev, mdev_ch);
 	if (!c)
 		return -ENODEV;
@@ -781,24 +781,24 @@ static ssize_t remove_link_store(struct device_driver *drv,
 #define DRV_ATTR(_name)  (&driver_attr_##_name.attr)
 
 static DRIVER_ATTR_RO(links);
-static DRIVER_ATTR_RO(modules);
+static DRIVER_ATTR_RO(components);
 static DRIVER_ATTR_WO(add_link);
 static DRIVER_ATTR_WO(remove_link);
 
-static struct attribute *module_attrs[] = {
+static struct attribute *mc_attrs[] = {
 	DRV_ATTR(links),
-	DRV_ATTR(modules),
+	DRV_ATTR(components),
 	DRV_ATTR(add_link),
 	DRV_ATTR(remove_link),
 	NULL,
 };
 
-static struct attribute_group module_attr_group = {
-	.attrs = module_attrs,
+static struct attribute_group mc_attr_group = {
+	.attrs = mc_attrs,
 };
 
-static const struct attribute_group *module_attr_groups[] = {
-	&module_attr_group,
+static const struct attribute_group *mc_attr_groups[] = {
+	&mc_attr_group,
 	NULL,
 };
 
@@ -1558,7 +1558,7 @@ static int __init most_init(void)
 	mc.bus.match = most_match,
 	mc.drv.name = "most_core",
 	mc.drv.bus = &mc.bus,
-	mc.drv.groups = module_attr_groups;
+	mc.drv.groups = mc_attr_groups;
 
 	err = bus_register(&mc.bus);
 	if (err) {
-- 
2.7.4

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

* [PATCH 40/50] staging: most: core: fix formatting
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (38 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 39/50] staging: most: core: denote modules as components Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 41/50] staging: most: usb: clear functional stall on OUT endpoint Christian Gromm
                   ` (11 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch fixes coding style violations.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c        | 7 +------
 drivers/staging/most/video/video.c | 2 +-
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index b0e9179..79a90a2 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -283,7 +283,6 @@ static ssize_t set_number_of_buffers_store(struct device *dev,
 					   size_t count)
 {
 	struct most_channel *c = to_channel(dev);
-
 	int ret = kstrtou16(buf, 0, &c->cfg.num_buffers);
 
 	if (ret)
@@ -669,13 +668,11 @@ inline int link_channel_to_component(struct most_channel *c,
 		return -ENOSPC;
 
 	*comp_ptr = comp;
-	ret = comp->probe_channel(c->iface, c->channel_id,
-				 &c->cfg, comp_param);
+	ret = comp->probe_channel(c->iface, c->channel_id, &c->cfg, comp_param);
 	if (ret) {
 		*comp_ptr = NULL;
 		return ret;
 	}
-
 	return 0;
 }
 
@@ -716,7 +713,6 @@ static ssize_t add_link_store(struct device_driver *drv,
 	size_t max_len = min_t(size_t, len + 1, STRING_SIZE);
 
 	strlcpy(buffer, buf, max_len);
-
 	ret = split_string(buffer, &mdev, &mdev_ch, &comp_name, &comp_param);
 	if (ret)
 		return ret;
@@ -734,7 +730,6 @@ static ssize_t add_link_store(struct device_driver *drv,
 	ret = link_channel_to_component(c, comp, comp_param);
 	if (ret)
 		return ret;
-
 	return len;
 }
 
diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
index 1577f36..a55a2e6 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -547,7 +547,7 @@ static int comp_probe_channel(struct most_interface *iface, int channel_idx,
 }
 
 static int comp_disconnect_channel(struct most_interface *iface,
-				  int channel_idx)
+				   int channel_idx)
 {
 	struct most_video_dev *mdev = get_comp_dev(iface, channel_idx);
 
-- 
2.7.4

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

* [PATCH 41/50] staging: most: usb: clear functional stall on OUT endpoint
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (39 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 40/50] staging: most: core: fix formatting Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-22 13:01   ` PrasannaKumar Muralidharan
  2017-11-21 14:05 ` [PATCH 42/50] staging: most: core: fix data type Christian Gromm
                   ` (10 subsequent siblings)
  51 siblings, 1 reply; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

For the MOST packet channel there are two dedicated USB endpoints. But
internally the hardware has actually one channel for data forwarding from
and to MOST. To have the hardware clean up its state machine correctly in
case of an error, both USB pipes need to be reset.  This patch triggers the
host to also clear the OUT endpoint's halt condition in case an IN endpoint
has signaled to be stalled.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/usb/usb.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index acd0a36..49f5495 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -815,6 +815,21 @@ static void wq_clear_halt(struct work_struct *wq_obj)
 	if (usb_clear_halt(mdev->usb_device, pipe))
 		dev_warn(&mdev->usb_device->dev, "Failed to reset endpoint.\n");
 
+	/* If the functional Stall condition has been set on an
+	 * asynchronous rx channel, we need to clear the tx channel
+	 * too, since the hardware runs its clean-up sequence on both
+	 * channels, as they are physically one on the network.
+	 *
+	 * The USB interface that exposes the asynchronous channels
+	 * contains always two endpoints, and two only.
+	 */
+	if (mdev->conf[channel].data_type == MOST_CH_ASYNC &&
+	    mdev->conf[channel].direction == MOST_CH_RX) {
+		int peer = 1 - channel;
+		int snd_pipe = usb_sndbulkpipe(mdev->usb_device,
+					       mdev->ep_address[peer]);
+		usb_clear_halt(mdev->usb_device, snd_pipe);
+	}
 	mdev->is_channel_healthy[channel] = true;
 	most_resume_enqueue(&mdev->iface, channel);
 	mutex_unlock(&mdev->io_mutex);
-- 
2.7.4

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

* [PATCH 42/50] staging: most: core: fix data type
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (40 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 41/50] staging: most: usb: clear functional stall on OUT endpoint Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-22 13:02   ` PrasannaKumar Muralidharan
  2017-11-24 15:09   ` Greg KH
  2017-11-21 14:05 ` [PATCH 43/50] staging: most: core: check value returned by match function Christian Gromm
                   ` (9 subsequent siblings)
  51 siblings, 2 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch fixes the type used to manage the channels of an
registered MOST interface.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h
index d6e9b87..7c44791 100644
--- a/drivers/staging/most/core.h
+++ b/drivers/staging/most/core.h
@@ -238,7 +238,7 @@ struct most_interface {
 	struct module *mod;
 	enum most_interface_type interface;
 	const char *description;
-	int num_channels;
+	unsigned int num_channels;
 	struct most_channel_capability *channel_vector;
 	int (*configure)(struct most_interface *iface, int channel_idx,
 			 struct most_channel_config *channel_config);
-- 
2.7.4

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

* [PATCH 43/50] staging: most: core: check value returned by match function
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (41 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 42/50] staging: most: core: fix data type Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 44/50] staging: most: update driver usage file Christian Gromm
                   ` (8 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch adds a check for the pointer returned by the function
match_component. It is needed to prevent a NULL pointer dereference in
case the provided component name does not match any list entry.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 79a90a2..72f1526 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -717,6 +717,8 @@ static ssize_t add_link_store(struct device_driver *drv,
 	if (ret)
 		return ret;
 	comp = match_component(comp_name);
+	if (!comp)
+		return -ENODEV;
 	if (!comp_param || *comp_param == 0) {
 		snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev,
 			 mdev_ch);
@@ -760,6 +762,8 @@ static ssize_t remove_link_store(struct device_driver *drv,
 	if (ret)
 		return ret;
 	comp = match_component(comp_name);
+	if (!comp)
+		return -ENODEV;
 	c = get_channel(mdev, mdev_ch);
 	if (!c)
 		return -ENODEV;
-- 
2.7.4

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

* [PATCH 44/50] staging: most: update driver usage file
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (42 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 43/50] staging: most: core: check value returned by match function Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 45/50] staging: most: cdev: replace function prefix Christian Gromm
                   ` (7 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Andrey Shvetsov, Christian Gromm

From: Andrey Shvetsov <andrey.shvetsov@k2l.de>

This patch keeps the usage file up to date.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 .../staging/most/Documentation/driver_usage.txt    | 192 +++++++++++----------
 1 file changed, 105 insertions(+), 87 deletions(-)

diff --git a/drivers/staging/most/Documentation/driver_usage.txt b/drivers/staging/most/Documentation/driver_usage.txt
index a4dc0c3..bb9b4e8 100644
--- a/drivers/staging/most/Documentation/driver_usage.txt
+++ b/drivers/staging/most/Documentation/driver_usage.txt
@@ -23,20 +23,29 @@ audio/video streaming. Therefore, the driver perfectly fits to the mission
 of Automotive Grade Linux to create open source software solutions for
 automotive applications.
 
-The driver consists basically of three layers. The hardware layer, the
-core layer and the application layer. The core layer consists of the core
-module only. This module handles the communication flow through all three
-layers, the configuration of the driver, the configuration interface
-representation in sysfs, and the buffer management.
-For each of the other two layers a selection of modules is provided. These
-modules can arbitrarily be combined to meet the needs of the desired
-system architecture. A module of the hardware layer is referred to as an
-HDM (hardware dependent module). Each module of this layer handles exactly
-one of the peripheral interfaces of a network interface controller (e.g.
-USB, MediaLB, I2C). A module of the application layer is referred to as an
-AIM (application interfacing module). The modules of this layer give access
-to MOST via one the following ways: character devices, ALSA, Networking or
-V4L2.
+The MOST driver uses module stacking to divide the associated modules into
+three layers. From bottom up these layers are: the adapter layer, the core
+layer and the application layer. The core layer implements the MOST
+subsystem and consists basically of the module core.c and its API. It
+registers the MOST bus with the kernel's device model, handles the data
+routing through all three layers, the configuration of the driver, the
+representation of the configuration interface in sysfs and the buffer
+management.
+
+For each of the other two layers a set of modules is provided. Those can be
+arbitrarily combined with the core to meet the connectivity of the desired
+system architecture.
+
+A module of the adapter layer is basically a device driver for a different
+subsystem. It is registered with the core to connect the MOST subsystem to
+the attached network interface controller hardware. Hence, a given module
+of this layer is designed to handle exactly one of the peripheral
+interfaces (e.g. USB, MediaLB, I2C) the hardware provides.
+
+A module of the application layer is referred to as a core comoponent,
+which kind of extends the core by providing connectivity to the user space.
+Applications, then, can access a MOST network via character devices, an
+ALSA soundcard, a Network adapter or a V4L2 capture device.
 
 To physically access MOST, an Intelligent Network Interface Controller
 (INIC) is needed. For more information on available controllers visit:
@@ -44,15 +53,14 @@ www.microchip.com
 
 
 
-		Section 1.1 Hardware Layer
+		Section 1.1 Adapter Layer
 
-The hardware layer contains so called hardware dependent modules (HDM). For each
-peripheral interface the hardware supports the driver has a suitable module
-that handles the interface.
-
-The HDMs encapsulate the peripheral interface specific knowledge of the driver
-and provides an easy way of extending the number of supported interfaces.
-Currently the following HDMs are available:
+The adapter layer contains a pool of device drivers. For each peripheral
+interface the hardware supports there is one suitable module that handles
+the interface. Adapter drivers encapsulate the peripheral interface
+specific knowledge of the MOST driver stack and provide an easy way of
+extending the number of supported interfaces. Currently the following
+interfaces are available:
 
 	1) MediaLB (DIM2)
 	   Host wants to communicate with hardware via MediaLB.
@@ -63,26 +71,34 @@ Currently the following HDMs are available:
 	3) USB
 	   Host wants to communicate with the hardware via USB.
 
+Once an adapter driver recognizes a MOST device being attached, it
+registers it with the core, which, in turn, assigns the necessary members
+of the embedded struct device (e.g. the bus this device belongs to and
+attribute groups) and registers it with the kernel's device model.
 
-		Section 1.2 Core Layer
-
-The core layer contains the mostcore module only, which processes the driver
-configuration via sysfs, buffer management and data forwarding.
 
+		Section 1.2 Core Layer
 
+This layer implements the MOST subsystem. It contains the core module and
+the header file most.h that exposes the API of the core. When inserted in
+the kernel, it registers the MOST bus_type with the kernel's device model
+and registers itself as a device driver for this bus. Besides these meta
+tasks the core populates the configuration directory for a registered MOST
+device (represented by struct most_interface) in sysfs and processes the
+configuration of the device's interface. The core layer also handles the
+buffer management and the data/message routing.
 
-		Section 1.2 Application Layer
 
-The application layer contains so called application interfacing modules (AIM).
-Depending on how the driver should interface to the application, one or more
-suitable modules can be selected.
+		Section 1.3 Application Layer
 
-The AIMs encapsulate the application interface specific knowledge of the driver
-and provides access to user space or other kernel subsystems.
-Currently the following AIMs are available
+This layer contains a pool of device drivers that are components of the
+core designed to make up the userspace experience of the MOST driver stack.
+Depending on how an application is meant to interface the driver, one or
+more modules of this pool can be registered with the core. Currently the
+following components are available
 
 	1) Character Device
-	   Applications can access the driver by means of character devices.
+	   Userspace can access the driver by means of character devices.
 
 	2) Networking
 	   Standard networking applications (e.g. iperf) can by used to access
@@ -97,84 +113,86 @@ Currently the following AIMs are available
 	   used to access the driver via the ALSA subsystem.
 
 
+		Section 2 Usage of the MOST Driver
 
-		Section 2 Configuration
+		Section 2.1 Configuration
 
-See ABI/sysfs-class-most.txt
+See ABI/sysfs-bus-most.txt
 
 
+		Section 2.2 Routing Channels
 
-		Section 3 USB Padding
+To connect a configured channel to a certain core component and make it
+accessible for user space applications, the driver attribute 'add_link' is
+used. The configuration string passed to it has the following format:
 
-When transceiving synchronous or isochronous data, the number of packets per USB
-transaction and the sub-buffer size need to be configured. These values
-are needed for the driver to process buffer padding, as expected by hardware,
-which is for performance optimization purposes of the USB transmission.
+	"device_name:channel_name:component_name:link_name[.param]"
 
-When transmitting synchronous data the allocated channel width needs to be
-written to 'set_subbuffer_size'. Additionally, the number of MOST frames that
-should travel to the host within one USB transaction need to be written to
-'packets_per_xact'.
+It is the concatenation of up to four substrings separated by a colon. The
+substrings contain the names of the MOST interface, the channel, the
+component driver and a custom name with which the link is going to be
+referenced with. Since some components need additional information, the
+link name can be extended with a component-specific parameter (separated by
+a dot). In case the character device component is loaded, the handle would
+also appear as a device node in the /dev directory.
 
-Internally the synchronous threshold is calculated as follows:
+Cdev component example:
+        $ echo "mdev0:ep_81:cdev:my_rx_channel" >$(DRV_DIR)/add_link
 
-	frame_size = set_subbuffer_size * packets_per_xact
 
-In case 'packets_per_xact' is set to 0xFF the maximum number of packets,
-allocated within one MOST frame, is calculated that fit into _one_ 512 byte
-USB full packet.
+Sound component example:
 
-	frame_size = floor(MTU_USB / bandwidth_sync) * bandwidth_sync
+The sound component needs an additional parameter to determine the audio
+resolution that is going to be used. The following formats are available:
 
-This frame_size is the number of synchronous data within an USB transaction,
-which renders MTU_USB - frame_size bytes for padding.
+	- "1x8" (Mono)
+	- "2x16" (16-bit stereo)
+	- "2x24" (24-bit stereo)
+	- "2x32" (32-bit stereo)
+	- "6x16" (16-bit surround 5.1)
 
-When transmitting isochronous AVP data the desired packet size needs to be
-written to 'set_subbuffer_size' and hardware will always expect two isochronous
-packets within one USB transaction. This renders
+        $ echo "mdev0:ep_81:sound:most51_playback.6x16" >$(DRV_DIR)/add_link
 
-	MTU_USB - (2 * set_subbuffer_size)
 
-bytes for padding.
-
-Note that at least 2 times set_subbuffer_size bytes for isochronous data or
-set_subbuffer_size times packts_per_xact bytes for synchronous data need to be
-put in the transmission buffer and passed to the driver.
 
-Since HDMs are allowed to change a chosen configuration to best fit its
-constraints, it is recommended to always double check the configuration and read
-back the previously written files.
+		Section 2.3 USB Padding
 
+When transceiving synchronous or isochronous data, the number of packets
+per USB transaction and the sub-buffer size need to be configured. These
+values are needed for the driver to process buffer padding, as expected by
+hardware, which is for performance optimization purposes of the USB
+transmission.
 
+When transmitting synchronous data the allocated channel width needs to be
+written to 'set_subbuffer_size'. Additionally, the number of MOST frames
+that should travel to the host within one USB transaction need to be
+written to 'packets_per_xact'.
 
-		Section 4 Routing Channels
+The driver, then, calculates the synchronous threshold as follows:
 
-To connect a channel that has been configured as outlined above to an AIM and
-make it accessible to user space applications, the attribute file 'add_link' is
-used. To actually bind a channel to the AIM a string needs to be written to the
-file that complies with the following syntax:
+	frame_size = set_subbuffer_size * packets_per_xact
 
-	"most_device:channel_name:link_name[.param]"
+In case 'packets_per_xact' is set to 0xFF the maximum number of packets,
+allocated within one MOST frame, is calculated that fit into _one_ 512 byte
+USB full packet.
 
-The example above links the channel "channel_name" of the device "most_device"
-to the AIM. In case the AIM interfaces the VFS this would also create a device
-node "link_name" in the /dev directory. The parameter "param" is an AIM dependent
-string, which can be omitted in case the used AIM does not make any use of it.
+	frame_size = floor(MTU_USB / bandwidth_sync) * bandwidth_sync
 
-Cdev AIM example:
-        $ echo "mdev0:ep_81:my_rx_channel" >add_link
-        $ echo "mdev0:ep_81" >add_link
+This frame_size is the number of synchronous data within an USB
+transaction, which renders MTU_USB - frame_size bytes for padding.
 
+When transmitting isochronous AVP data the desired packet size needs to be
+written to 'set_subbuffer_size' and hardware will always expect two
+isochronous packets within one USB transaction. This renders
 
-Sound/ALSA AIM example:
+	MTU_USB - (2 * set_subbuffer_size)
 
-The sound/ALSA AIM needs an additional parameter to determine the audio resolution
-that is going to be used. The following strings can be used:
+bytes for padding.
 
-	- "1x8" (Mono)
-	- "2x16" (16-bit stereo)
-	- "2x24" (24-bit stereo)
-	- "2x32" (32-bit stereo)
+Note that at least (2 * set_subbuffer_size) bytes for isochronous data or
+(set_subbuffer_size * packts_per_xact) bytes for synchronous data need to
+be put in the transmission buffer and passed to the driver.
 
-        $ echo "mdev0:ep_81:audio_rx.2x16" >add_link
-        $ echo "mdev0:ep_81" >add_link
+Since adapter drivers are allowed to change a chosen configuration to best
+fit its constraints, it is recommended to always double check the
+configuration and read back the previously written files.
-- 
2.7.4

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

* [PATCH 45/50] staging: most: cdev: replace function prefix
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (43 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 44/50] staging: most: update driver usage file Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 46/50] staging: most: cdev: bundle module variables in structure Christian Gromm
                   ` (6 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch replaces the function prefixes aim_* with comp_*. It is needed
to complete the process of changing the module designator from AIM to
Component.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/cdev/cdev.c | 58 ++++++++++++++++++++--------------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c
index 225369d..be535ae 100644
--- a/drivers/staging/most/cdev/cdev.c
+++ b/drivers/staging/most/cdev/cdev.c
@@ -112,14 +112,14 @@ static void destroy_channel(struct comp_channel *c)
 }
 
 /**
- * aim_open - implements the syscall to open the device
+ * comp_open - implements the syscall to open the device
  * @inode: inode pointer
  * @filp: file pointer
  *
  * This stores the channel pointer in the private data field of
  * the file structure and activates the channel within the core.
  */
-static int aim_open(struct inode *inode, struct file *filp)
+static int comp_open(struct inode *inode, struct file *filp)
 {
 	struct comp_channel *c;
 	int ret;
@@ -157,13 +157,13 @@ static int aim_open(struct inode *inode, struct file *filp)
 }
 
 /**
- * aim_close - implements the syscall to close the device
+ * comp_close - implements the syscall to close the device
  * @inode: inode pointer
  * @filp: file pointer
  *
  * This stops the channel within the core.
  */
-static int aim_close(struct inode *inode, struct file *filp)
+static int comp_close(struct inode *inode, struct file *filp)
 {
 	struct comp_channel *c = to_channel(inode->i_cdev);
 
@@ -182,14 +182,14 @@ static int aim_close(struct inode *inode, struct file *filp)
 }
 
 /**
- * aim_write - implements the syscall to write to the device
+ * comp_write - implements the syscall to write to the device
  * @filp: file pointer
  * @buf: pointer to user buffer
  * @count: number of bytes to write
  * @offset: offset from where to start writing
  */
-static ssize_t aim_write(struct file *filp, const char __user *buf,
-			 size_t count, loff_t *offset)
+static ssize_t comp_write(struct file *filp, const char __user *buf,
+			  size_t count, loff_t *offset)
 {
 	int ret;
 	size_t to_copy, left;
@@ -236,14 +236,14 @@ static ssize_t aim_write(struct file *filp, const char __user *buf,
 }
 
 /**
- * aim_read - implements the syscall to read from the device
+ * comp_read - implements the syscall to read from the device
  * @filp: file pointer
  * @buf: pointer to user buffer
  * @count: number of bytes to read
  * @offset: offset from where to start reading
  */
 static ssize_t
-aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset)
+comp_read(struct file *filp, char __user *buf, size_t count, loff_t *offset)
 {
 	size_t to_copy, not_copied, copied;
 	struct mbo *mbo;
@@ -287,7 +287,7 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset)
 	return copied;
 }
 
-static unsigned int aim_poll(struct file *filp, poll_table *wait)
+static unsigned int comp_poll(struct file *filp, poll_table *wait)
 {
 	struct comp_channel *c = filp->private_data;
 	unsigned int mask = 0;
@@ -309,22 +309,22 @@ static unsigned int aim_poll(struct file *filp, poll_table *wait)
  */
 static const struct file_operations channel_fops = {
 	.owner = THIS_MODULE,
-	.read = aim_read,
-	.write = aim_write,
-	.open = aim_open,
-	.release = aim_close,
-	.poll = aim_poll,
+	.read = comp_read,
+	.write = comp_write,
+	.open = comp_open,
+	.release = comp_close,
+	.poll = comp_poll,
 };
 
 /**
- * aim_disconnect_channel - disconnect a channel
+ * comp_disconnect_channel - disconnect a channel
  * @iface: pointer to interface instance
  * @channel_id: channel index
  *
  * This frees allocated memory and removes the cdev that represents this
  * channel in user space.
  */
-static int aim_disconnect_channel(struct most_interface *iface, int channel_id)
+static int comp_disconnect_channel(struct most_interface *iface, int channel_id)
 {
 	struct comp_channel *c;
 
@@ -354,13 +354,13 @@ static int aim_disconnect_channel(struct most_interface *iface, int channel_id)
 }
 
 /**
- * aim_rx_completion - completion handler for rx channels
+ * comp_rx_completion - completion handler for rx channels
  * @mbo: pointer to buffer object that has completed
  *
  * This searches for the channel linked to this MBO and stores it in the local
  * fifo buffer.
  */
-static int aim_rx_completion(struct mbo *mbo)
+static int comp_rx_completion(struct mbo *mbo)
 {
 	struct comp_channel *c;
 
@@ -387,13 +387,13 @@ static int aim_rx_completion(struct mbo *mbo)
 }
 
 /**
- * aim_tx_completion - completion handler for tx channels
+ * comp_tx_completion - completion handler for tx channels
  * @iface: pointer to interface instance
  * @channel_id: channel index/ID
  *
  * This wakes sleeping processes in the wait-queue.
  */
-static int aim_tx_completion(struct most_interface *iface, int channel_id)
+static int comp_tx_completion(struct most_interface *iface, int channel_id)
 {
 	struct comp_channel *c;
 
@@ -414,7 +414,7 @@ static int aim_tx_completion(struct most_interface *iface, int channel_id)
 }
 
 /**
- * aim_probe - probe function of the driver module
+ * comp_probe - probe function of the driver module
  * @iface: pointer to interface instance
  * @channel_id: channel index/ID
  * @cfg: pointer to actual channel configuration
@@ -424,8 +424,8 @@ static int aim_tx_completion(struct most_interface *iface, int channel_id)
  *
  * Returns 0 on success or error code otherwise.
  */
-static int aim_probe(struct most_interface *iface, int channel_id,
-		     struct most_channel_config *cfg, char *name)
+static int comp_probe(struct most_interface *iface, int channel_id,
+		      struct most_channel_config *cfg, char *name)
 {
 	struct comp_channel *c;
 	unsigned long cl_flags;
@@ -433,7 +433,7 @@ static int aim_probe(struct most_interface *iface, int channel_id,
 	int current_minor;
 
 	if ((!iface) || (!cfg) || (!name)) {
-		pr_info("Probing AIM with bad arguments");
+		pr_info("Probing component with bad arguments");
 		return -EINVAL;
 	}
 	c = get_channel(iface, channel_id);
@@ -497,10 +497,10 @@ static int aim_probe(struct most_interface *iface, int channel_id,
 
 static struct core_component cdev_comp = {
 	.name = "cdev",
-	.probe_channel = aim_probe,
-	.disconnect_channel = aim_disconnect_channel,
-	.rx_completion = aim_rx_completion,
-	.tx_completion = aim_tx_completion,
+	.probe_channel = comp_probe,
+	.disconnect_channel = comp_disconnect_channel,
+	.rx_completion = comp_rx_completion,
+	.tx_completion = comp_tx_completion,
 };
 
 static int __init mod_init(void)
-- 
2.7.4

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

* [PATCH 46/50] staging: most: cdev: bundle module variables in structure
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (44 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 45/50] staging: most: cdev: replace function prefix Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 47/50] staging: most: core: remove class generation Christian Gromm
                   ` (5 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch creates the structure comp to put the module variables for
encapsulation purposes. For an improved readability some variables are
renamed.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/cdev/cdev.c | 88 ++++++++++++++++++++--------------------
 1 file changed, 43 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c
index be535ae..6dcd4f3 100644
--- a/drivers/staging/most/cdev/cdev.c
+++ b/drivers/staging/most/cdev/cdev.c
@@ -24,11 +24,13 @@
 #include <linux/idr.h>
 #include "most/core.h"
 
-static dev_t comp_devno;
-static struct class *comp_class;
-static struct ida minor_id;
-static unsigned int major;
-static struct core_component cdev_comp;
+static struct cdev_component {
+	dev_t devno;
+	struct ida minor_id;
+	unsigned int major;
+	struct class *class;
+	struct core_component cc;
+} comp;
 
 struct comp_channel {
 	wait_queue_head_t wq;
@@ -52,13 +54,13 @@ static spinlock_t ch_list_lock;
 
 static inline bool ch_has_mbo(struct comp_channel *c)
 {
-	return channel_has_mbo(c->iface, c->channel_id, &cdev_comp) > 0;
+	return channel_has_mbo(c->iface, c->channel_id, &comp.cc) > 0;
 }
 
 static inline bool ch_get_mbo(struct comp_channel *c, struct mbo **mbo)
 {
 	if (!kfifo_peek(&c->fifo, mbo)) {
-		*mbo = most_get_mbo(c->iface, c->channel_id, &cdev_comp);
+		*mbo = most_get_mbo(c->iface, c->channel_id, &comp.cc);
 		if (*mbo)
 			kfifo_in(&c->fifo, mbo, 1);
 	}
@@ -90,14 +92,14 @@ static void stop_channel(struct comp_channel *c)
 
 	while (kfifo_out((struct kfifo *)&c->fifo, &mbo, 1))
 		most_put_mbo(mbo);
-	most_stop_channel(c->iface, c->channel_id, &cdev_comp);
+	most_stop_channel(c->iface, c->channel_id, &comp.cc);
 }
 
 static void destroy_cdev(struct comp_channel *c)
 {
 	unsigned long flags;
 
-	device_destroy(comp_class, c->devno);
+	device_destroy(comp.class, c->devno);
 	cdev_del(&c->cdev);
 	spin_lock_irqsave(&ch_list_lock, flags);
 	list_del(&c->list);
@@ -106,7 +108,7 @@ static void destroy_cdev(struct comp_channel *c)
 
 static void destroy_channel(struct comp_channel *c)
 {
-	ida_simple_remove(&minor_id, MINOR(c->devno));
+	ida_simple_remove(&comp.minor_id, MINOR(c->devno));
 	kfifo_free(&c->fifo);
 	kfree(c);
 }
@@ -149,7 +151,7 @@ static int comp_open(struct inode *inode, struct file *filp)
 	}
 
 	c->mbo_offs = 0;
-	ret = most_start_channel(c->iface, c->channel_id, &cdev_comp);
+	ret = most_start_channel(c->iface, c->channel_id, &comp.cc);
 	if (!ret)
 		c->access_ref = 1;
 	mutex_unlock(&c->io_mutex);
@@ -440,7 +442,7 @@ static int comp_probe(struct most_interface *iface, int channel_id,
 	if (c)
 		return -EEXIST;
 
-	current_minor = ida_simple_get(&minor_id, 0, 0, GFP_KERNEL);
+	current_minor = ida_simple_get(&comp.minor_id, 0, 0, GFP_KERNEL);
 	if (current_minor < 0)
 		return current_minor;
 
@@ -450,7 +452,7 @@ static int comp_probe(struct most_interface *iface, int channel_id,
 		goto error_alloc_channel;
 	}
 
-	c->devno = MKDEV(major, current_minor);
+	c->devno = MKDEV(comp.major, current_minor);
 	cdev_init(&c->cdev, &channel_fops);
 	c->cdev.owner = THIS_MODULE;
 	cdev_add(&c->cdev, c->devno, 1);
@@ -470,11 +472,7 @@ static int comp_probe(struct most_interface *iface, int channel_id,
 	spin_lock_irqsave(&ch_list_lock, cl_flags);
 	list_add_tail(&c->list, &channel_list);
 	spin_unlock_irqrestore(&ch_list_lock, cl_flags);
-	c->dev = device_create(comp_class,
-				     NULL,
-				     c->devno,
-				     NULL,
-				     "%s", name);
+	c->dev = device_create(comp.class, NULL, c->devno, NULL, "%s", name);
 
 	if (IS_ERR(c->dev)) {
 		retval = PTR_ERR(c->dev);
@@ -491,16 +489,18 @@ static int comp_probe(struct most_interface *iface, int channel_id,
 	cdev_del(&c->cdev);
 	kfree(c);
 error_alloc_channel:
-	ida_simple_remove(&minor_id, current_minor);
+	ida_simple_remove(&comp.minor_id, current_minor);
 	return retval;
 }
 
-static struct core_component cdev_comp = {
-	.name = "cdev",
-	.probe_channel = comp_probe,
-	.disconnect_channel = comp_disconnect_channel,
-	.rx_completion = comp_rx_completion,
-	.tx_completion = comp_tx_completion,
+static struct cdev_component comp = {
+	.cc = {
+		.name = "cdev",
+		.probe_channel = comp_probe,
+		.disconnect_channel = comp_disconnect_channel,
+		.rx_completion = comp_rx_completion,
+		.tx_completion = comp_tx_completion,
+	},
 };
 
 static int __init mod_init(void)
@@ -509,32 +509,30 @@ static int __init mod_init(void)
 
 	pr_info("init()\n");
 
+	comp.class = class_create(THIS_MODULE, "most_cdev");
+	if (IS_ERR(comp.class)) {
+		pr_info("No udev support.\n");
+		return PTR_ERR(comp.class);
+	}
+
 	INIT_LIST_HEAD(&channel_list);
 	spin_lock_init(&ch_list_lock);
-	ida_init(&minor_id);
+	ida_init(&comp.minor_id);
 
-	err = alloc_chrdev_region(&comp_devno, 0, 50, "cdev");
+	err = alloc_chrdev_region(&comp.devno, 0, 50, "cdev");
 	if (err < 0)
 		goto dest_ida;
-	major = MAJOR(comp_devno);
-
-	comp_class = class_create(THIS_MODULE, "most_cdev_comp");
-	if (IS_ERR(comp_class)) {
-		pr_err("no udev support\n");
-		err = PTR_ERR(comp_class);
-		goto free_cdev;
-	}
-	err = most_register_component(&cdev_comp);
+	comp.major = MAJOR(comp.devno);
+	err = most_register_component(&comp.cc);
 	if (err)
-		goto dest_class;
+		goto free_cdev;
 	return 0;
 
-dest_class:
-	class_destroy(comp_class);
 free_cdev:
-	unregister_chrdev_region(comp_devno, 1);
+	unregister_chrdev_region(comp.devno, 1);
 dest_ida:
-	ida_destroy(&minor_id);
+	ida_destroy(&comp.minor_id);
+	class_destroy(comp.class);
 	return err;
 }
 
@@ -544,15 +542,15 @@ static void __exit mod_exit(void)
 
 	pr_info("exit module\n");
 
-	most_deregister_component(&cdev_comp);
+	most_deregister_component(&comp.cc);
 
 	list_for_each_entry_safe(c, tmp, &channel_list, list) {
 		destroy_cdev(c);
 		destroy_channel(c);
 	}
-	class_destroy(comp_class);
-	unregister_chrdev_region(comp_devno, 1);
-	ida_destroy(&minor_id);
+	unregister_chrdev_region(comp.devno, 1);
+	ida_destroy(&comp.minor_id);
+	class_destroy(comp.class);
 }
 
 module_init(mod_init);
-- 
2.7.4

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

* [PATCH 47/50] staging: most: core: remove class generation
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (45 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 46/50] staging: most: cdev: bundle module variables in structure Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-22 13:02   ` PrasannaKumar Muralidharan
  2017-11-21 14:05 ` [PATCH 48/50] staging: most: core: fix list traversing Christian Gromm
                   ` (4 subsequent siblings)
  51 siblings, 1 reply; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch stops the core from generating a module owned class and
registering it with the kernel. It is needed, because there is no need for
a default MOST class to be present in the kernel.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 72f1526..d03ff97 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -39,7 +39,6 @@ static struct mostcore {
 	struct device dev;
 	struct device_driver drv;
 	struct bus_type bus;
-	struct class *class;
 	struct list_head comp_list;
 } mc;
 
@@ -1564,17 +1563,10 @@ static int __init most_init(void)
 		pr_info("Cannot register most bus\n");
 		return err;
 	}
-	mc.class = class_create(THIS_MODULE, "most");
-	if (IS_ERR(mc.class)) {
-		pr_info("No udev support.\n");
-		err = PTR_ERR(mc.class);
-		goto exit_bus;
-	}
-
 	err = driver_register(&mc.drv);
 	if (err) {
 		pr_info("Cannot register core driver\n");
-		goto exit_class;
+		goto exit_bus;
 	}
 	mc.dev.init_name = "most_bus";
 	mc.dev.release = release_most_sub;
@@ -1587,8 +1579,6 @@ static int __init most_init(void)
 
 exit_driver:
 	driver_unregister(&mc.drv);
-exit_class:
-	class_destroy(mc.class);
 exit_bus:
 	bus_unregister(&mc.bus);
 	return err;
@@ -1599,7 +1589,6 @@ static void __exit most_exit(void)
 	pr_info("exit core module\n");
 	device_unregister(&mc.dev);
 	driver_unregister(&mc.drv);
-	class_destroy(mc.class);
 	bus_unregister(&mc.bus);
 	ida_destroy(&mdev_id);
 }
-- 
2.7.4

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

* [PATCH 48/50] staging: most: core: fix list traversing
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (46 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 47/50] staging: most: core: remove class generation Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 49/50] staging: most: add ABI documentation Christian Gromm
                   ` (3 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Andrey Shvetsov, Christian Gromm

From: Andrey Shvetsov <andrey.shvetsov@k2l.de>

This patch fixes the offset and data handling when traversing
the list of devices that are attached to the bus.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/core.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index d03ff97..9729206 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -535,10 +535,16 @@ static struct core_component *match_component(char *name)
 	return NULL;
 }
 
+struct show_links_data {
+	int offs;
+	char *buf;
+};
+
 int print_links(struct device *dev, void *data)
 {
-	int offs = 0;
-	char *buf = data;
+	struct show_links_data *d = data;
+	int offs = d->offs;
+	char *buf = d->buf;
 	struct most_channel *c;
 	struct most_interface *iface = to_most_interface(dev);
 
@@ -560,13 +566,16 @@ int print_links(struct device *dev, void *data)
 					 dev_name(&c->dev));
 		}
 	}
+	d->offs = offs;
 	return 0;
 }
 
 static ssize_t links_show(struct device_driver *drv, char *buf)
 {
-	bus_for_each_dev(&mc.bus, NULL, buf, print_links);
-	return strlen(buf);
+	struct show_links_data d = { .buf = buf };
+
+	bus_for_each_dev(&mc.bus, NULL, &d, print_links);
+	return d.offs;
 }
 
 static ssize_t components_show(struct device_driver *drv, char *buf)
-- 
2.7.4

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

* [PATCH 49/50] staging: most: add ABI documentation
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (47 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 48/50] staging: most: core: fix list traversing Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-21 14:05 ` [PATCH 50/50] staging: most: usb: fix show/store function names Christian Gromm
                   ` (2 subsequent siblings)
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patchg adds the sysfs-bus-most.txt file to the source tree.
It is needed to have an ABI description of the driver's sysfs
interface.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 .../most/Documentation/ABI/sysfs-bus-most.txt      | 313 +++++++++++++++++++++
 1 file changed, 313 insertions(+)
 create mode 100644 drivers/staging/most/Documentation/ABI/sysfs-bus-most.txt

diff --git a/drivers/staging/most/Documentation/ABI/sysfs-bus-most.txt b/drivers/staging/most/Documentation/ABI/sysfs-bus-most.txt
new file mode 100644
index 0000000..d8fa841
--- /dev/null
+++ b/drivers/staging/most/Documentation/ABI/sysfs-bus-most.txt
@@ -0,0 +1,313 @@
+What:		/sys/bus/most/devices/.../description
+Date:		March 2017
+KernelVersion:	4.15
+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>
+Users:
+
+What:		/sys/bus/most/devices/.../interface
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		Indicates the type of peripheral interface the device uses.
+Users:
+
+What:		/sys/bus/most/devices/.../dci
+Date:		June 2016
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		If the network interface controller is attached via USB, a dci
+		directory is created that allows applications to read and
+		write the controller's DCI registers.
+Users:
+
+What:		/sys/bus/most/devices/.../dci/arb_address
+Date:		June 2016
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is used to set an arbitrary DCI register address an
+		application wants to read from or write to.
+Users:
+
+What:		/sys/bus/most/devices/.../dci/arb_value
+Date:		June 2016
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is used to read and write the DCI register whose address
+		is stored in arb_address.
+Users:
+
+What:		/sys/bus/most/devices/.../dci/mep_eui48_hi
+Date:		June 2016
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is used to check and configure the MAC address.
+Users:
+
+What:		/sys/bus/most/devices/.../dci/mep_eui48_lo
+Date:		June 2016
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is used to check and configure the MAC address.
+Users:
+
+What:		/sys/bus/most/devices/.../dci/mep_eui48_mi
+Date:		June 2016
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is used to check and configure the MAC address.
+Users:
+
+What:		/sys/bus/most/devices/.../dci/mep_filter
+Date:		June 2016
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is used to check and configure the MEP filter address.
+Users:
+
+What:		/sys/bus/most/devices/.../dci/mep_hash0
+Date:		June 2016
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is used to check and configure the MEP hash table.
+Users:
+
+What:		/sys/bus/most/devices/.../dci/mep_hash1
+Date:		June 2016
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is used to check and configure the MEP hash table.
+Users:
+
+What:		/sys/bus/most/devices/.../dci/mep_hash2
+Date:		June 2016
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is used to check and configure the MEP hash table.
+Users:
+
+What:		/sys/bus/most/devices/.../dci/mep_hash3
+Date:		June 2016
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is used to check and configure the MEP hash table.
+Users:
+
+What:		/sys/bus/most/devices/.../dci/ni_state
+Date:		June 2016
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		Indicates the current network interface state.
+Users:
+
+What:		/sys/bus/most/devices/.../dci/node_address
+Date:		June 2016
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		Indicates the current node address.
+Users:
+
+What:		/sys/bus/most/devices/.../dci/node_position
+Date:		June 2016
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		Indicates the current node position.
+Users:
+
+What:		/sys/bus/most/devices/.../dci/packet_bandwidth
+Date:		June 2016
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		Indicates the configured packet bandwidth.
+Users:
+
+What:		/sys/bus/most/devices/.../dci/sync_ep
+Date:		June 2016
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		Triggers the controller's synchronization process for a certain
+		endpoint.
+Users:
+
+What:		/sys/bus/most/devices/.../<channel>/
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		For every channel of the device a directory is created, whose
+		name is dictated by the HDM. This enables an application to
+		collect information about the channel's capabilities and
+		configure it.
+Users:
+
+What:		/sys/bus/most/devices/.../<channel>/available_datatypes
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		Indicates the data types the current channel can transport.
+Users:
+
+What:		/sys/bus/most/devices/.../<channel>/available_directions
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		Indicates the directions the current channel is capable of.
+Users:
+
+What:		/sys/bus/most/devices/.../<channel>/number_of_packet_buffers
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		Indicates the number of packet buffers the current channel can
+		handle.
+Users:
+
+What:		/sys/bus/most/devices/.../<channel>/number_of_stream_buffers
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		Indicates the number of streaming buffers the current channel can
+		handle.
+Users:
+
+What:		/sys/bus/most/devices/.../<channel>/size_of_packet_buffer
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		Indicates the size of a packet buffer the current channel can
+		handle.
+Users:
+
+What:		/sys/bus/most/devices/.../<channel>/size_of_stream_buffer
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		Indicates the size of a streaming buffer the current channel can
+		handle.
+Users:
+
+What:		/sys/bus/most/devices/.../<channel>/set_number_of_buffers
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is to configure the number of buffers of the current channel.
+Users:
+
+What:		/sys/bus/most/devices/.../<channel>/set_buffer_size
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is to configure the size of a buffer of the current channel.
+Users:
+
+What:		/sys/bus/most/devices/.../<channel>/set_direction
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is to configure the direction of the current channel.
+		The following strings will be accepted:
+			'dir_tx',
+			'dir_rx'
+Users:
+
+What:		/sys/bus/most/devices/.../<channel>/set_datatype
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is to configure the data type of the current channel.
+		The following strings will be accepted:
+			'control',
+			'async',
+			'sync',
+			'isoc_avp'
+Users:
+
+What:		/sys/bus/most/devices/.../<channel>/set_subbuffer_size
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is to configure the subbuffer size of the current channel.
+Users:
+
+What:		/sys/bus/most/devices/.../<channel>/set_packets_per_xact
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is to configure the number of packets per transaction of
+		the current channel. This is only needed network interface
+		controller is attached via USB.
+Users:
+
+What:		/sys/bus/most/devices/.../<channel>/channel_starving
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+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
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is used to retrieve a list of registered components.
+Users:
+
+What:		/sys/bus/most/drivers/mostcore/links
+Date:		March 2017
+KernelVersion:	4.15
+Contact:	Christian Gromm <christian.gromm@microchip.com>
+Description:
+		This is used to retrieve a list of established links.
+Users:
-- 
2.7.4

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

* [PATCH 50/50] staging: most: usb: fix show/store function names
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (48 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 49/50] staging: most: add ABI documentation Christian Gromm
@ 2017-11-21 14:05 ` Christian Gromm
  2017-11-22 13:00 ` [PATCH 00/50] staging: most: rework driver architecture and fix defects PrasannaKumar Muralidharan
  2017-11-24 15:31 ` Greg KH
  51 siblings, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-21 14:05 UTC (permalink / raw)
  To: gregkh; +Cc: driverdev-devel, Christian Gromm

This patch renames the show/store functions of the USB module.
It is needed to make the module meet the established naming
convention.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
 drivers/staging/most/usb/usb.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index 49f5495..b5369b4 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -893,7 +893,7 @@ static int get_stat_reg_addr(const struct regs *regs, int size,
 #define get_static_reg_addr(regs, name, reg_addr) \
 	get_stat_reg_addr(regs, ARRAY_SIZE(regs), name, reg_addr)
 
-static ssize_t show_value(struct device *dev, struct device_attribute *attr,
+static ssize_t value_show(struct device *dev, struct device_attribute *attr,
 			  char *buf)
 {
 	const char *name = attr->attr.name;
@@ -918,7 +918,7 @@ static ssize_t show_value(struct device *dev, struct device_attribute *attr,
 	return snprintf(buf, PAGE_SIZE, "%04x\n", val);
 }
 
-static ssize_t store_value(struct device *dev, struct device_attribute *attr,
+static ssize_t value_store(struct device *dev, struct device_attribute *attr,
 			   const char *buf, size_t count)
 {
 	u16 val;
@@ -951,21 +951,21 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr,
 	return count;
 }
 
-DEVICE_ATTR(ni_state, 0444, show_value, NULL);
-DEVICE_ATTR(packet_bandwidth, 0444, show_value, NULL);
-DEVICE_ATTR(node_address, 0444, show_value, NULL);
-DEVICE_ATTR(node_position, 0444, show_value, NULL);
-DEVICE_ATTR(sync_ep, 0200, NULL, store_value);
-DEVICE_ATTR(mep_filter, 0644, show_value, store_value);
-DEVICE_ATTR(mep_hash0, 0644, show_value, store_value);
-DEVICE_ATTR(mep_hash1, 0644, show_value, store_value);
-DEVICE_ATTR(mep_hash2, 0644, show_value, store_value);
-DEVICE_ATTR(mep_hash3, 0644, show_value, store_value);
-DEVICE_ATTR(mep_eui48_hi, 0644, show_value, store_value);
-DEVICE_ATTR(mep_eui48_mi, 0644, show_value, store_value);
-DEVICE_ATTR(mep_eui48_lo, 0644, show_value, store_value);
-DEVICE_ATTR(arb_address, 0644, show_value, store_value);
-DEVICE_ATTR(arb_value, 0644, show_value, store_value);
+DEVICE_ATTR(ni_state, 0444, value_show, NULL);
+DEVICE_ATTR(packet_bandwidth, 0444, value_show, NULL);
+DEVICE_ATTR(node_address, 0444, value_show, NULL);
+DEVICE_ATTR(node_position, 0444, value_show, NULL);
+DEVICE_ATTR(sync_ep, 0200, NULL, value_store);
+DEVICE_ATTR(mep_filter, 0644, value_show, value_store);
+DEVICE_ATTR(mep_hash0, 0644, value_show, value_store);
+DEVICE_ATTR(mep_hash1, 0644, value_show, value_store);
+DEVICE_ATTR(mep_hash2, 0644, value_show, value_store);
+DEVICE_ATTR(mep_hash3, 0644, value_show, value_store);
+DEVICE_ATTR(mep_eui48_hi, 0644, value_show, value_store);
+DEVICE_ATTR(mep_eui48_mi, 0644, value_show, value_store);
+DEVICE_ATTR(mep_eui48_lo, 0644, value_show, value_store);
+DEVICE_ATTR(arb_address, 0644, value_show, value_store);
+DEVICE_ATTR(arb_value, 0644, value_show, value_store);
 
 static struct attribute *dci_attrs[] = {
 	&dev_attr_ni_state.attr,
-- 
2.7.4

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

* Re: [PATCH 10/50] staging: most: core: remove function get_channel_by_iface
  2017-11-21 14:04 ` [PATCH 10/50] staging: most: core: remove function get_channel_by_iface Christian Gromm
@ 2017-11-22 10:44   ` Frans Klaver
  0 siblings, 0 replies; 68+ messages in thread
From: Frans Klaver @ 2017-11-22 10:44 UTC (permalink / raw)
  To: Christian Gromm; +Cc: Greg KH, driverdev-devel

On Tue, Nov 21, 2017 at 3:04 PM, Christian Gromm
<christian.gromm@microchip.com> wrote:
> This patch removes the function get_channel_by_iface that walks a list of
> all registered interfaces and returns a pointer to a channel when matched.
> Instead the private field of the interface structure is used to directly
> access the channel via the id. The patch is needed to remove unnecessary
> list traversing.

get_channel_by_iface causes a lot of list traversions when trying to
match the channel. If we store our most instance in the interfaces
private pointer, we can access the channel directly. The search is now
no longer necessary and get_channel_by_iface can be removed.

Same story, none of the, I feel, awkward "This patch does blabla" style text.

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

* Re: [PATCH 00/50] staging: most: rework driver architecture and fix defects
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (49 preceding siblings ...)
  2017-11-21 14:05 ` [PATCH 50/50] staging: most: usb: fix show/store function names Christian Gromm
@ 2017-11-22 13:00 ` PrasannaKumar Muralidharan
  2017-11-24 15:11   ` Greg KH
  2017-11-24 15:31 ` Greg KH
  51 siblings, 1 reply; 68+ messages in thread
From: PrasannaKumar Muralidharan @ 2017-11-22 13:00 UTC (permalink / raw)
  To: Christian Gromm; +Cc: Greg KH, driverdev-devel

Hi Christian,

On 21 November 2017 at 19:34, Christian Gromm
<christian.gromm@microchip.com> wrote:
> This patch set fixes bugs and integrates the driver to the kernel's device
> model by revising its architecture. Part of this change is rearranging the
> directory layout, renaming of files and folders and thereby creating a
> clean driver structure.
>
>
> Andrey Shvetsov (2):
>   staging: most: update driver usage file
>   staging: most: core: fix list traversing
>
> Christian Gromm (48):
>   staging: most: move core files
>   staging: most: cdev: rename module
>   staging: most: i2c: rename module
>   staging: most: dim2: rename module
>   staging: most: net: rename module
>   staging: most: sound: rename module
>   staging: most: usb: rename module
>   staging: most: video: rename module
>   staging: most: remove proprietary kobjects
>   staging: most: core: remove function get_channel_by_iface
>   staging: most: core: add a match function for the bus
>   staging: most: core: encapsulate code in function
>   staging: most: core: rename structure
>   staging: most: core: rename struct most_c_aim_obj to pipe
>   staging: most: core: rename struct memeber
>   staging: most: core: rename members aim* of struct most_channel
>   staging: most: core: use structure to pack driver specific data
>   staging: most: core: track aim modules with linked list
>   staging: most: core: fix sysfs attribute management
>   staging: most: core: remove struct device
>   staging: most: core: rename function
>   staging: most: core: replace struct most_inst_obj
>   staging: most: core: put channel name in struct most_channel
>   staging: most: core: remove context pointer
>   staging: most: usb: remove pointer initialization
>   staging: most: rename struct most_aim
>   staging: most: rename functions to register a driver with most_core
>   staging: most: core: rename mod_list
>   staging: most: core: rename aim variables
>   staging: most: core: rename function link_channel_to_aim
>   staging: most: net: remove aim designators
>   staging: most: sound: remove aim designator
>   staging: most: video: remove aim designators
>   staging: most: cdev: rename struct aim_channel
>   staging: most: cdev: rename variable aim_devno
>   staging: most: cdev: rename class instance aim_class
>   staging: most: cdev: rename variable cdev_aim
>   staging: most: fix comment sections
>   staging: most: core: denote modules as components
>   staging: most: core: fix formatting
>   staging: most: usb: clear functional stall on OUT endpoint
>   staging: most: core: fix data type
>   staging: most: core: check value returned by match function
>   staging: most: cdev: replace function prefix
>   staging: most: cdev: bundle module variables in structure
>   staging: most: core: remove class generation
>   staging: most: add ABI documentation
>   staging: most: usb: fix show/store function names
>
>  .../most/Documentation/ABI/sysfs-bus-most.txt      |  313 ++++
>  .../staging/most/Documentation/driver_usage.txt    |  192 +-
>  drivers/staging/most/Kconfig                       |   27 +-
>  drivers/staging/most/Makefile                      |    5 +-
>  drivers/staging/most/aim-cdev/Makefile             |    2 +-
>  drivers/staging/most/aim-network/Makefile          |    2 +-
>  drivers/staging/most/aim-sound/Makefile            |    2 +-
>  drivers/staging/most/aim-v4l2/Makefile             |    2 +-
>  drivers/staging/most/{aim-cdev => cdev}/Kconfig    |    6 +-
>  drivers/staging/most/cdev/Makefile                 |    4 +
>  drivers/staging/most/{aim-cdev => cdev}/cdev.c     |  186 +-
>  drivers/staging/most/core.c                        | 1609 ++++++++++++++++
>  .../staging/most/{mostcore/mostcore.h => core.h}   |   69 +-
>  drivers/staging/most/{hdm-dim2 => dim2}/Kconfig    |    6 +-
>  drivers/staging/most/dim2/Makefile                 |    4 +
>  .../most/{hdm-dim2/dim2_hdm.c => dim2/dim2.c}      |   31 +-
>  .../most/{hdm-dim2/dim2_hdm.h => dim2/dim2.h}      |    2 +-
>  .../most/{hdm-dim2/dim2_errors.h => dim2/errors.h} |    2 +-
>  .../most/{hdm-dim2/dim2_hal.c => dim2/hal.c}       |    8 +-
>  .../most/{hdm-dim2/dim2_hal.h => dim2/hal.h}       |    4 +-
>  .../most/{hdm-dim2/dim2_reg.h => dim2/reg.h}       |    2 +-
>  drivers/staging/most/dim2/sysfs.c                  |   55 +
>  .../most/{hdm-dim2/dim2_sysfs.h => dim2/sysfs.h}   |    8 +-
>  drivers/staging/most/hdm-dim2/Makefile             |    2 +-
>  drivers/staging/most/hdm-dim2/dim2_sysfs.c         |  115 --
>  drivers/staging/most/hdm-i2c/Makefile              |    2 +-
>  drivers/staging/most/hdm-usb/Makefile              |    2 +-
>  drivers/staging/most/{hdm-i2c => i2c}/Kconfig      |    6 +-
>  drivers/staging/most/i2c/Makefile                  |    4 +
>  .../staging/most/{hdm-i2c/hdm_i2c.c => i2c/i2c.c}  |   11 +-
>  drivers/staging/most/mostcore/Kconfig              |   14 -
>  drivers/staging/most/mostcore/Makefile             |    3 -
>  drivers/staging/most/mostcore/core.c               | 1949 --------------------
>  drivers/staging/most/{aim-network => net}/Kconfig  |    6 +-
>  drivers/staging/most/net/Makefile                  |    4 +
>  .../most/{aim-network/networking.c => net/net.c}   |   51 +-
>  drivers/staging/most/{aim-sound => sound}/Kconfig  |    6 +-
>  drivers/staging/most/sound/Makefile                |    4 +
>  drivers/staging/most/{aim-sound => sound}/sound.c  |   25 +-
>  drivers/staging/most/{hdm-usb => usb}/Kconfig      |    7 +-
>  drivers/staging/most/usb/Makefile                  |    4 +
>  .../staging/most/{hdm-usb/hdm_usb.c => usb/usb.c}  |  264 +--
>  drivers/staging/most/{aim-v4l2 => video}/Kconfig   |    6 +-
>  drivers/staging/most/video/Makefile                |    4 +
>  drivers/staging/most/{aim-v4l2 => video}/video.c   |  159 +-
>  45 files changed, 2511 insertions(+), 2678 deletions(-)
>  create mode 100644 drivers/staging/most/Documentation/ABI/sysfs-bus-most.txt
>  rename drivers/staging/most/{aim-cdev => cdev}/Kconfig (70%)
>  create mode 100644 drivers/staging/most/cdev/Makefile
>  rename drivers/staging/most/{aim-cdev => cdev}/cdev.c (70%)
>  create mode 100644 drivers/staging/most/core.c
>  rename drivers/staging/most/{mostcore/mostcore.h => core.h} (86%)
>  rename drivers/staging/most/{hdm-dim2 => dim2}/Kconfig (83%)
>  create mode 100644 drivers/staging/most/dim2/Makefile
>  rename drivers/staging/most/{hdm-dim2/dim2_hdm.c => dim2/dim2.c} (98%)
>  rename drivers/staging/most/{hdm-dim2/dim2_hdm.h => dim2/dim2.h} (94%)
>  rename drivers/staging/most/{hdm-dim2/dim2_errors.h => dim2/errors.h} (95%)
>  rename drivers/staging/most/{hdm-dim2/dim2_hal.c => dim2/hal.c} (99%)
>  rename drivers/staging/most/{hdm-dim2/dim2_hal.h => dim2/hal.h} (98%)
>  rename drivers/staging/most/{hdm-dim2/dim2_reg.h => dim2/reg.h} (98%)
>  create mode 100644 drivers/staging/most/dim2/sysfs.c
>  rename drivers/staging/most/{hdm-dim2/dim2_sysfs.h => dim2/sysfs.h} (79%)
>  delete mode 100644 drivers/staging/most/hdm-dim2/dim2_sysfs.c
>  rename drivers/staging/most/{hdm-i2c => i2c}/Kconfig (72%)
>  create mode 100644 drivers/staging/most/i2c/Makefile
>  rename drivers/staging/most/{hdm-i2c/hdm_i2c.c => i2c/i2c.c} (98%)
>  delete mode 100644 drivers/staging/most/mostcore/Kconfig
>  delete mode 100644 drivers/staging/most/mostcore/Makefile
>  delete mode 100644 drivers/staging/most/mostcore/core.c
>  rename drivers/staging/most/{aim-network => net}/Kconfig (69%)
>  create mode 100644 drivers/staging/most/net/Makefile
>  rename drivers/staging/most/{aim-network/networking.c => net/net.c} (91%)
>  rename drivers/staging/most/{aim-sound => sound}/Kconfig (72%)
>  create mode 100644 drivers/staging/most/sound/Makefile
>  rename drivers/staging/most/{aim-sound => sound}/sound.c (97%)
>  rename drivers/staging/most/{hdm-usb => usb}/Kconfig (77%)
>  create mode 100644 drivers/staging/most/usb/Makefile
>  rename drivers/staging/most/{hdm-usb/hdm_usb.c => usb/usb.c} (86%)
>  rename drivers/staging/most/{aim-v4l2 => video}/Kconfig (71%)
>  create mode 100644 drivers/staging/most/video/Makefile
>  rename drivers/staging/most/{aim-v4l2 => video}/video.c (76%)
>
> --
> 2.7.4
>
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Appreciate your effort in splitting up the patches. But reviewing 50
patches is too difficult. It is extremely difficult to keep track of
what 3rd patch does while looking at 21st patch. Can you send multiple
patch series instead of one huge patch series?

Nonetheless I have few comments for the patch.

Regards,
PrasannaKumar

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

* Re: [PATCH 20/50] staging: most: core: remove struct device
  2017-11-21 14:04 ` [PATCH 20/50] staging: most: core: remove struct device Christian Gromm
@ 2017-11-22 13:01   ` PrasannaKumar Muralidharan
  2017-11-24 15:10     ` Greg KH
  0 siblings, 1 reply; 68+ messages in thread
From: PrasannaKumar Muralidharan @ 2017-11-22 13:01 UTC (permalink / raw)
  To: Christian Gromm; +Cc: Greg KH, driverdev-devel

Hi Christian,

On 21 November 2017 at 19:34, Christian Gromm
<christian.gromm@microchip.com> wrote:
> This patch takes out the struct device of struct most_aim, because it is
> not needed.

Patch 9 adds struct device to struct most_aim and this patch removes
it. I think not adding struct device to struct most_aim in patch 9 is
a better way to go.

Regards,
PrasannaKumar

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

* Re: [PATCH 26/50] staging: most: rename struct most_aim
  2017-11-21 14:05 ` [PATCH 26/50] staging: most: rename struct most_aim Christian Gromm
@ 2017-11-22 13:01   ` PrasannaKumar Muralidharan
  0 siblings, 0 replies; 68+ messages in thread
From: PrasannaKumar Muralidharan @ 2017-11-22 13:01 UTC (permalink / raw)
  To: Christian Gromm; +Cc: Greg KH, driverdev-devel

Hi Christian,

On 21 November 2017 at 19:35, Christian Gromm
<christian.gromm@microchip.com> wrote:
> The designator of a module that proivdes means to interface userspace is
> called an AIM. Since this name seems to be unappropiate, this kind of
> moduels are going to be referred to as componetns. This is done because
> such modules function as components to enhance the core with new features.
> This patch renames the struct most_aim to core_component.

Using the word component does not provide much info either. Appreciate
if you can find a better name than core_component.

Regards,
PrasannaKumar

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

* Re: [PATCH 41/50] staging: most: usb: clear functional stall on OUT endpoint
  2017-11-21 14:05 ` [PATCH 41/50] staging: most: usb: clear functional stall on OUT endpoint Christian Gromm
@ 2017-11-22 13:01   ` PrasannaKumar Muralidharan
  0 siblings, 0 replies; 68+ messages in thread
From: PrasannaKumar Muralidharan @ 2017-11-22 13:01 UTC (permalink / raw)
  To: Christian Gromm; +Cc: Greg KH, driverdev-devel

Hi Christian,

On 21 November 2017 at 19:35, Christian Gromm
<christian.gromm@microchip.com> wrote:
> For the MOST packet channel there are two dedicated USB endpoints. But
> internally the hardware has actually one channel for data forwarding from
> and to MOST. To have the hardware clean up its state machine correctly in
> case of an error, both USB pipes need to be reset.  This patch triggers the
> host to also clear the OUT endpoint's halt condition in case an IN endpoint
> has signaled to be stalled.
>
> Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
> ---
>  drivers/staging/most/usb/usb.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
> index acd0a36..49f5495 100644
> --- a/drivers/staging/most/usb/usb.c
> +++ b/drivers/staging/most/usb/usb.c
> @@ -815,6 +815,21 @@ static void wq_clear_halt(struct work_struct *wq_obj)
>         if (usb_clear_halt(mdev->usb_device, pipe))
>                 dev_warn(&mdev->usb_device->dev, "Failed to reset endpoint.\n");
>
> +       /* If the functional Stall condition has been set on an
> +        * asynchronous rx channel, we need to clear the tx channel
> +        * too, since the hardware runs its clean-up sequence on both
> +        * channels, as they are physically one on the network.
> +        *
> +        * The USB interface that exposes the asynchronous channels
> +        * contains always two endpoints, and two only.
> +        */
> +       if (mdev->conf[channel].data_type == MOST_CH_ASYNC &&
> +           mdev->conf[channel].direction == MOST_CH_RX) {
> +               int peer = 1 - channel;
> +               int snd_pipe = usb_sndbulkpipe(mdev->usb_device,
> +                                              mdev->ep_address[peer]);
> +               usb_clear_halt(mdev->usb_device, snd_pipe);
> +       }
>         mdev->is_channel_healthy[channel] = true;
>         most_resume_enqueue(&mdev->iface, channel);
>         mutex_unlock(&mdev->io_mutex);
> --
> 2.7.4
>
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

This fix is independent of the series. Can you decouple this and post
as a separate patch? This fix can go in even if the series takes time
to go in.

Regards,
PrasannaKumar

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

* Re: [PATCH 47/50] staging: most: core: remove class generation
  2017-11-21 14:05 ` [PATCH 47/50] staging: most: core: remove class generation Christian Gromm
@ 2017-11-22 13:02   ` PrasannaKumar Muralidharan
  0 siblings, 0 replies; 68+ messages in thread
From: PrasannaKumar Muralidharan @ 2017-11-22 13:02 UTC (permalink / raw)
  To: Christian Gromm; +Cc: Greg KH, driverdev-devel

Hi Christian,

On 21 November 2017 at 19:35, Christian Gromm
<christian.gromm@microchip.com> wrote:
> This patch stops the core from generating a module owned class and
> registering it with the kernel. It is needed, because there is no need for

Should be "It is not needed". Not is missing.

> a default MOST class to be present in the kernel.
>
> Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
> ---
>  drivers/staging/most/core.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
> index 72f1526..d03ff97 100644
> --- a/drivers/staging/most/core.c
> +++ b/drivers/staging/most/core.c
> @@ -39,7 +39,6 @@ static struct mostcore {
>         struct device dev;
>         struct device_driver drv;
>         struct bus_type bus;
> -       struct class *class;
>         struct list_head comp_list;
>  } mc;
>
> @@ -1564,17 +1563,10 @@ static int __init most_init(void)
>                 pr_info("Cannot register most bus\n");
>                 return err;
>         }
> -       mc.class = class_create(THIS_MODULE, "most");
> -       if (IS_ERR(mc.class)) {
> -               pr_info("No udev support.\n");
> -               err = PTR_ERR(mc.class);
> -               goto exit_bus;
> -       }
> -
>         err = driver_register(&mc.drv);
>         if (err) {
>                 pr_info("Cannot register core driver\n");
> -               goto exit_class;
> +               goto exit_bus;
>         }
>         mc.dev.init_name = "most_bus";
>         mc.dev.release = release_most_sub;
> @@ -1587,8 +1579,6 @@ static int __init most_init(void)
>
>  exit_driver:
>         driver_unregister(&mc.drv);
> -exit_class:
> -       class_destroy(mc.class);
>  exit_bus:
>         bus_unregister(&mc.bus);
>         return err;
> @@ -1599,7 +1589,6 @@ static void __exit most_exit(void)
>         pr_info("exit core module\n");
>         device_unregister(&mc.dev);
>         driver_unregister(&mc.drv);
> -       class_destroy(mc.class);
>         bus_unregister(&mc.bus);
>         ida_destroy(&mdev_id);
>  }
> --
> 2.7.4
>
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Regards,
PrasannaKumar

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

* Re: [PATCH 42/50] staging: most: core: fix data type
  2017-11-21 14:05 ` [PATCH 42/50] staging: most: core: fix data type Christian Gromm
@ 2017-11-22 13:02   ` PrasannaKumar Muralidharan
  2017-11-24 15:09   ` Greg KH
  1 sibling, 0 replies; 68+ messages in thread
From: PrasannaKumar Muralidharan @ 2017-11-22 13:02 UTC (permalink / raw)
  To: Christian Gromm; +Cc: Greg KH, driverdev-devel

Hi Christian,

On 21 November 2017 at 19:35, Christian Gromm
<christian.gromm@microchip.com> wrote:
> This patch fixes the type used to manage the channels of an
> registered MOST interface.
>
> Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
> ---
>  drivers/staging/most/core.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h
> index d6e9b87..7c44791 100644
> --- a/drivers/staging/most/core.h
> +++ b/drivers/staging/most/core.h
> @@ -238,7 +238,7 @@ struct most_interface {
>         struct module *mod;
>         enum most_interface_type interface;
>         const char *description;
> -       int num_channels;
> +       unsigned int num_channels;

This change is independent of the series. Can you decouple this from
the series and send it as separate patch?

>         struct most_channel_capability *channel_vector;
>         int (*configure)(struct most_interface *iface, int channel_idx,
>                          struct most_channel_config *channel_config);
> --
> 2.7.4
>
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Regards,
PrasannaKumar

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

* Re: [PATCH 08/50] staging: most: video: rename module
  2017-11-21 14:04 ` [PATCH 08/50] staging: most: video: " Christian Gromm
@ 2017-11-24 15:08   ` Greg KH
  0 siblings, 0 replies; 68+ messages in thread
From: Greg KH @ 2017-11-24 15:08 UTC (permalink / raw)
  To: Christian Gromm; +Cc: driverdev-devel

On Tue, Nov 21, 2017 at 03:04:42PM +0100, Christian Gromm wrote:
> This patch renames the folder of the video module. It is needed
> to clean up the directory layout of the driver.
> 
> Signed-off-by: Christian Gromm <christian.gromm@microchip.com>

I've applied the first 8 of these patches, but I don't think they do
what you wanted them to do, given that now none of the individual
drivers are actually built :(

I'm guessing you tested this somehow, but it doesn't look like you did.
Maybe you wanted none of the modules to build anymore?

Anyway, I suggest looking at my staging-testing branch right now and
sending a patch to fix this up...

thanks,

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

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

* Re: [PATCH 42/50] staging: most: core: fix data type
  2017-11-21 14:05 ` [PATCH 42/50] staging: most: core: fix data type Christian Gromm
  2017-11-22 13:02   ` PrasannaKumar Muralidharan
@ 2017-11-24 15:09   ` Greg KH
  1 sibling, 0 replies; 68+ messages in thread
From: Greg KH @ 2017-11-24 15:09 UTC (permalink / raw)
  To: Christian Gromm; +Cc: driverdev-devel

On Tue, Nov 21, 2017 at 03:05:16PM +0100, Christian Gromm wrote:
> This patch fixes the type used to manage the channels of an
> registered MOST interface.
> 
> Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
> ---
>  drivers/staging/most/core.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h
> index d6e9b87..7c44791 100644
> --- a/drivers/staging/most/core.h
> +++ b/drivers/staging/most/core.h
> @@ -238,7 +238,7 @@ struct most_interface {
>  	struct module *mod;
>  	enum most_interface_type interface;
>  	const char *description;
> -	int num_channels;
> +	unsigned int num_channels;

"fixes" it in what way?  What's wrong with just an int?  What is the bug
at this point in time without the patch?

Please be more descriptive...

thanks,

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

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

* Re: [PATCH 20/50] staging: most: core: remove struct device
  2017-11-22 13:01   ` PrasannaKumar Muralidharan
@ 2017-11-24 15:10     ` Greg KH
  2017-11-24 15:20       ` Greg KH
  0 siblings, 1 reply; 68+ messages in thread
From: Greg KH @ 2017-11-24 15:10 UTC (permalink / raw)
  To: PrasannaKumar Muralidharan, Christian Gromm; +Cc: driverdev-devel

On Wed, Nov 22, 2017 at 06:31:19PM +0530, PrasannaKumar Muralidharan wrote:
> Hi Christian,
> 
> On 21 November 2017 at 19:34, Christian Gromm
> <christian.gromm@microchip.com> wrote:
> > This patch takes out the struct device of struct most_aim, because it is
> > not needed.
> 
> Patch 9 adds struct device to struct most_aim and this patch removes
> it. I think not adding struct device to struct most_aim in patch 9 is
> a better way to go.

I agree, this feels odd.

Christian, please rebase the series based on my staging-next branch and
fix up patch 9 so that this patch is not needed.

thanks,

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

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

* Re: [PATCH 00/50] staging: most: rework driver architecture and fix defects
  2017-11-22 13:00 ` [PATCH 00/50] staging: most: rework driver architecture and fix defects PrasannaKumar Muralidharan
@ 2017-11-24 15:11   ` Greg KH
  0 siblings, 0 replies; 68+ messages in thread
From: Greg KH @ 2017-11-24 15:11 UTC (permalink / raw)
  To: PrasannaKumar Muralidharan; +Cc: Christian Gromm, driverdev-devel

On Wed, Nov 22, 2017 at 06:30:42PM +0530, PrasannaKumar Muralidharan wrote:
> Hi Christian,
> 
> On 21 November 2017 at 19:34, Christian Gromm
> <christian.gromm@microchip.com> wrote:
> > This patch set fixes bugs and integrates the driver to the kernel's device
> > model by revising its architecture. Part of this change is rearranging the
> > directory layout, renaming of files and folders and thereby creating a
> > clean driver structure.
> >
> >
> > Andrey Shvetsov (2):
> >   staging: most: update driver usage file
> >   staging: most: core: fix list traversing
> >
> > Christian Gromm (48):
> >   staging: most: move core files
> >   staging: most: cdev: rename module
> >   staging: most: i2c: rename module
> >   staging: most: dim2: rename module
> >   staging: most: net: rename module
> >   staging: most: sound: rename module
> >   staging: most: usb: rename module
> >   staging: most: video: rename module
> >   staging: most: remove proprietary kobjects
> >   staging: most: core: remove function get_channel_by_iface
> >   staging: most: core: add a match function for the bus
> >   staging: most: core: encapsulate code in function
> >   staging: most: core: rename structure
> >   staging: most: core: rename struct most_c_aim_obj to pipe
> >   staging: most: core: rename struct memeber
> >   staging: most: core: rename members aim* of struct most_channel
> >   staging: most: core: use structure to pack driver specific data
> >   staging: most: core: track aim modules with linked list
> >   staging: most: core: fix sysfs attribute management
> >   staging: most: core: remove struct device
> >   staging: most: core: rename function
> >   staging: most: core: replace struct most_inst_obj
> >   staging: most: core: put channel name in struct most_channel
> >   staging: most: core: remove context pointer
> >   staging: most: usb: remove pointer initialization
> >   staging: most: rename struct most_aim
> >   staging: most: rename functions to register a driver with most_core
> >   staging: most: core: rename mod_list
> >   staging: most: core: rename aim variables
> >   staging: most: core: rename function link_channel_to_aim
> >   staging: most: net: remove aim designators
> >   staging: most: sound: remove aim designator
> >   staging: most: video: remove aim designators
> >   staging: most: cdev: rename struct aim_channel
> >   staging: most: cdev: rename variable aim_devno
> >   staging: most: cdev: rename class instance aim_class
> >   staging: most: cdev: rename variable cdev_aim
> >   staging: most: fix comment sections
> >   staging: most: core: denote modules as components
> >   staging: most: core: fix formatting
> >   staging: most: usb: clear functional stall on OUT endpoint
> >   staging: most: core: fix data type
> >   staging: most: core: check value returned by match function
> >   staging: most: cdev: replace function prefix
> >   staging: most: cdev: bundle module variables in structure
> >   staging: most: core: remove class generation
> >   staging: most: add ABI documentation
> >   staging: most: usb: fix show/store function names
> >
> >  .../most/Documentation/ABI/sysfs-bus-most.txt      |  313 ++++
> >  .../staging/most/Documentation/driver_usage.txt    |  192 +-
> >  drivers/staging/most/Kconfig                       |   27 +-
> >  drivers/staging/most/Makefile                      |    5 +-
> >  drivers/staging/most/aim-cdev/Makefile             |    2 +-
> >  drivers/staging/most/aim-network/Makefile          |    2 +-
> >  drivers/staging/most/aim-sound/Makefile            |    2 +-
> >  drivers/staging/most/aim-v4l2/Makefile             |    2 +-
> >  drivers/staging/most/{aim-cdev => cdev}/Kconfig    |    6 +-
> >  drivers/staging/most/cdev/Makefile                 |    4 +
> >  drivers/staging/most/{aim-cdev => cdev}/cdev.c     |  186 +-
> >  drivers/staging/most/core.c                        | 1609 ++++++++++++++++
> >  .../staging/most/{mostcore/mostcore.h => core.h}   |   69 +-
> >  drivers/staging/most/{hdm-dim2 => dim2}/Kconfig    |    6 +-
> >  drivers/staging/most/dim2/Makefile                 |    4 +
> >  .../most/{hdm-dim2/dim2_hdm.c => dim2/dim2.c}      |   31 +-
> >  .../most/{hdm-dim2/dim2_hdm.h => dim2/dim2.h}      |    2 +-
> >  .../most/{hdm-dim2/dim2_errors.h => dim2/errors.h} |    2 +-
> >  .../most/{hdm-dim2/dim2_hal.c => dim2/hal.c}       |    8 +-
> >  .../most/{hdm-dim2/dim2_hal.h => dim2/hal.h}       |    4 +-
> >  .../most/{hdm-dim2/dim2_reg.h => dim2/reg.h}       |    2 +-
> >  drivers/staging/most/dim2/sysfs.c                  |   55 +
> >  .../most/{hdm-dim2/dim2_sysfs.h => dim2/sysfs.h}   |    8 +-
> >  drivers/staging/most/hdm-dim2/Makefile             |    2 +-
> >  drivers/staging/most/hdm-dim2/dim2_sysfs.c         |  115 --
> >  drivers/staging/most/hdm-i2c/Makefile              |    2 +-
> >  drivers/staging/most/hdm-usb/Makefile              |    2 +-
> >  drivers/staging/most/{hdm-i2c => i2c}/Kconfig      |    6 +-
> >  drivers/staging/most/i2c/Makefile                  |    4 +
> >  .../staging/most/{hdm-i2c/hdm_i2c.c => i2c/i2c.c}  |   11 +-
> >  drivers/staging/most/mostcore/Kconfig              |   14 -
> >  drivers/staging/most/mostcore/Makefile             |    3 -
> >  drivers/staging/most/mostcore/core.c               | 1949 --------------------
> >  drivers/staging/most/{aim-network => net}/Kconfig  |    6 +-
> >  drivers/staging/most/net/Makefile                  |    4 +
> >  .../most/{aim-network/networking.c => net/net.c}   |   51 +-
> >  drivers/staging/most/{aim-sound => sound}/Kconfig  |    6 +-
> >  drivers/staging/most/sound/Makefile                |    4 +
> >  drivers/staging/most/{aim-sound => sound}/sound.c  |   25 +-
> >  drivers/staging/most/{hdm-usb => usb}/Kconfig      |    7 +-
> >  drivers/staging/most/usb/Makefile                  |    4 +
> >  .../staging/most/{hdm-usb/hdm_usb.c => usb/usb.c}  |  264 +--
> >  drivers/staging/most/{aim-v4l2 => video}/Kconfig   |    6 +-
> >  drivers/staging/most/video/Makefile                |    4 +
> >  drivers/staging/most/{aim-v4l2 => video}/video.c   |  159 +-
> >  45 files changed, 2511 insertions(+), 2678 deletions(-)
> >  create mode 100644 drivers/staging/most/Documentation/ABI/sysfs-bus-most.txt
> >  rename drivers/staging/most/{aim-cdev => cdev}/Kconfig (70%)
> >  create mode 100644 drivers/staging/most/cdev/Makefile
> >  rename drivers/staging/most/{aim-cdev => cdev}/cdev.c (70%)
> >  create mode 100644 drivers/staging/most/core.c
> >  rename drivers/staging/most/{mostcore/mostcore.h => core.h} (86%)
> >  rename drivers/staging/most/{hdm-dim2 => dim2}/Kconfig (83%)
> >  create mode 100644 drivers/staging/most/dim2/Makefile
> >  rename drivers/staging/most/{hdm-dim2/dim2_hdm.c => dim2/dim2.c} (98%)
> >  rename drivers/staging/most/{hdm-dim2/dim2_hdm.h => dim2/dim2.h} (94%)
> >  rename drivers/staging/most/{hdm-dim2/dim2_errors.h => dim2/errors.h} (95%)
> >  rename drivers/staging/most/{hdm-dim2/dim2_hal.c => dim2/hal.c} (99%)
> >  rename drivers/staging/most/{hdm-dim2/dim2_hal.h => dim2/hal.h} (98%)
> >  rename drivers/staging/most/{hdm-dim2/dim2_reg.h => dim2/reg.h} (98%)
> >  create mode 100644 drivers/staging/most/dim2/sysfs.c
> >  rename drivers/staging/most/{hdm-dim2/dim2_sysfs.h => dim2/sysfs.h} (79%)
> >  delete mode 100644 drivers/staging/most/hdm-dim2/dim2_sysfs.c
> >  rename drivers/staging/most/{hdm-i2c => i2c}/Kconfig (72%)
> >  create mode 100644 drivers/staging/most/i2c/Makefile
> >  rename drivers/staging/most/{hdm-i2c/hdm_i2c.c => i2c/i2c.c} (98%)
> >  delete mode 100644 drivers/staging/most/mostcore/Kconfig
> >  delete mode 100644 drivers/staging/most/mostcore/Makefile
> >  delete mode 100644 drivers/staging/most/mostcore/core.c
> >  rename drivers/staging/most/{aim-network => net}/Kconfig (69%)
> >  create mode 100644 drivers/staging/most/net/Makefile
> >  rename drivers/staging/most/{aim-network/networking.c => net/net.c} (91%)
> >  rename drivers/staging/most/{aim-sound => sound}/Kconfig (72%)
> >  create mode 100644 drivers/staging/most/sound/Makefile
> >  rename drivers/staging/most/{aim-sound => sound}/sound.c (97%)
> >  rename drivers/staging/most/{hdm-usb => usb}/Kconfig (77%)
> >  create mode 100644 drivers/staging/most/usb/Makefile
> >  rename drivers/staging/most/{hdm-usb/hdm_usb.c => usb/usb.c} (86%)
> >  rename drivers/staging/most/{aim-v4l2 => video}/Kconfig (71%)
> >  create mode 100644 drivers/staging/most/video/Makefile
> >  rename drivers/staging/most/{aim-v4l2 => video}/video.c (76%)
> >
> > --
> > 2.7.4
> >
> > _______________________________________________
> > devel mailing list
> > devel@linuxdriverproject.org
> > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
> 
> Appreciate your effort in splitting up the patches. But reviewing 50
> patches is too difficult. It is extremely difficult to keep track of
> what 3rd patch does while looking at 21st patch. Can you send multiple
> patch series instead of one huge patch series?

What?  No, 50 patches is just fine, if you can't review them all, then
don't :)

But there's going to be a new patch series anyway, it's good to get some
of them applied and then rebase and resend.

thanks,

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

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

* Re: [PATCH 09/50] staging: most: remove proprietary kobjects
  2017-11-21 14:04 ` [PATCH 09/50] staging: most: remove proprietary kobjects Christian Gromm
@ 2017-11-24 15:19   ` Greg KH
  0 siblings, 0 replies; 68+ messages in thread
From: Greg KH @ 2017-11-24 15:19 UTC (permalink / raw)
  To: Christian Gromm; +Cc: driverdev-devel

On Tue, Nov 21, 2017 at 03:04:43PM +0100, Christian Gromm wrote:
> This patch removes the proprietary kobjects used by the driver modules and
> replaces them with device structs. The patch is needed to have the driver
> being integrated into the kernel's device model.
> 
> Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
> ---
>  drivers/staging/most/cdev/cdev.c   |   6 +-
>  drivers/staging/most/core.c        | 803 +++++++++++--------------------------
>  drivers/staging/most/core.h        |  13 +-
>  drivers/staging/most/dim2/dim2.c   |  19 +-
>  drivers/staging/most/dim2/sysfs.c  |  92 +----
>  drivers/staging/most/dim2/sysfs.h  |   6 +-
>  drivers/staging/most/i2c/i2c.c     |   7 +-
>  drivers/staging/most/net/net.c     |   3 +-
>  drivers/staging/most/sound/sound.c |   3 +-
>  drivers/staging/most/usb/usb.c     | 243 +++--------
>  drivers/staging/most/video/video.c |   3 +-
>  11 files changed, 342 insertions(+), 856 deletions(-)

This is a tough patch to do all at once, but nice job.

It's really hard to review what is going on here, but I'll have to trust
it and then I can do a better review of the interaction with the driver
model after the patch is applied.

One minor nit though, make the DEVICE_ATTR* all static please, and
possibly use ATTRIBUTE_GROUPS()?

thanks,

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

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

* Re: [PATCH 20/50] staging: most: core: remove struct device
  2017-11-24 15:10     ` Greg KH
@ 2017-11-24 15:20       ` Greg KH
  0 siblings, 0 replies; 68+ messages in thread
From: Greg KH @ 2017-11-24 15:20 UTC (permalink / raw)
  To: PrasannaKumar Muralidharan, Christian Gromm; +Cc: driverdev-devel

On Fri, Nov 24, 2017 at 04:10:40PM +0100, Greg KH wrote:
> On Wed, Nov 22, 2017 at 06:31:19PM +0530, PrasannaKumar Muralidharan wrote:
> > Hi Christian,
> > 
> > On 21 November 2017 at 19:34, Christian Gromm
> > <christian.gromm@microchip.com> wrote:
> > > This patch takes out the struct device of struct most_aim, because it is
> > > not needed.
> > 
> > Patch 9 adds struct device to struct most_aim and this patch removes
> > it. I think not adding struct device to struct most_aim in patch 9 is
> > a better way to go.
> 
> I agree, this feels odd.
> 
> Christian, please rebase the series based on my staging-next branch and
> fix up patch 9 so that this patch is not needed.

No, this is ok, nevermind, let me queue this up so we have a solid place
to work off of...

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

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

* Re: [PATCH 00/50] staging: most: rework driver architecture and fix defects
  2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
                   ` (50 preceding siblings ...)
  2017-11-22 13:00 ` [PATCH 00/50] staging: most: rework driver architecture and fix defects PrasannaKumar Muralidharan
@ 2017-11-24 15:31 ` Greg KH
  2017-11-24 15:46   ` Christian Gromm
  2017-11-27 13:38   ` Christian Gromm
  51 siblings, 2 replies; 68+ messages in thread
From: Greg KH @ 2017-11-24 15:31 UTC (permalink / raw)
  To: Christian Gromm; +Cc: driverdev-devel

On Tue, Nov 21, 2017 at 03:04:34PM +0100, Christian Gromm wrote:
> This patch set fixes bugs and integrates the driver to the kernel's device
> model by revising its architecture. Part of this change is rearranging the
> directory layout, renaming of files and folders and thereby creating a
> clean driver structure.

Ok I've now applied all of these to my testing branch.  I think you need
to make some follow-up patches:
	- fix the build to actually compile the individual drivers :)
	- make DEVICE_ATTR structures static
	- use ATTRIBUTE_GROUPS where you can
	- use DEVICE_ATTR_RW() and _RO and _WO instead of a "raw"
	  DEVICE_ATTR() call.  There should not be any need to be having
	  any "special" file permissions for all of these attributes.
	- make sure you do not have any "empty" release functions.  I
	  saw one you removed, verify you don't have any others.

thanks,

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

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

* Re: [PATCH 00/50] staging: most: rework driver architecture and fix defects
  2017-11-24 15:31 ` Greg KH
@ 2017-11-24 15:46   ` Christian Gromm
  2017-11-27 13:38   ` Christian Gromm
  1 sibling, 0 replies; 68+ messages in thread
From: Christian Gromm @ 2017-11-24 15:46 UTC (permalink / raw)
  To: Greg KH; +Cc: driverdev-devel

On 24.11.2017 16:31, Greg KH wrote:
> On Tue, Nov 21, 2017 at 03:04:34PM +0100, Christian Gromm wrote:
>> This patch set fixes bugs and integrates the driver to the kernel's device
>> model by revising its architecture. Part of this change is rearranging the
>> directory layout, renaming of files and folders and thereby creating a
>> clean driver structure.
> 
> Ok I've now applied all of these to my testing branch.  I think you need
> to make some follow-up patches:
> 	- fix the build to actually compile the individual drivers :)
> 	- make DEVICE_ATTR structures static
> 	- use ATTRIBUTE_GROUPS where you can
> 	- use DEVICE_ATTR_RW() and _RO and _WO instead of a "raw"
> 	  DEVICE_ATTR() call.  There should not be any need to be having
> 	  any "special" file permissions for all of these attributes.
> 	- make sure you do not have any "empty" release functions.  I
> 	  saw one you removed, verify you don't have any others.


Nice. This makes it a lot easier than reworking the series.

thanks,
Chris

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

* Re: [PATCH 00/50] staging: most: rework driver architecture and fix defects
  2017-11-24 15:31 ` Greg KH
  2017-11-24 15:46   ` Christian Gromm
@ 2017-11-27 13:38   ` Christian Gromm
  2017-11-27 15:07     ` Greg KH
  1 sibling, 1 reply; 68+ messages in thread
From: Christian Gromm @ 2017-11-27 13:38 UTC (permalink / raw)
  To: Greg KH; +Cc: driverdev-devel

On 24.11.2017 16:31, Greg KH wrote:
> On Tue, Nov 21, 2017 at 03:04:34PM +0100, Christian Gromm wrote:
>> This patch set fixes bugs and integrates the driver to the kernel's device
>> model by revising its architecture. Part of this change is rearranging the
>> directory layout, renaming of files and folders and thereby creating a
>> clean driver structure.
> 
> Ok I've now applied all of these to my testing branch.  I think you need
> to make some follow-up patches:
> 	- fix the build to actually compile the individual drivers :)
> 	- make DEVICE_ATTR structures static
> 	- use ATTRIBUTE_GROUPS where you can
> 	- use DEVICE_ATTR_RW() and _RO and _WO instead of a "raw"
> 	  DEVICE_ATTR() call.  There should not be any need to be having
> 	  any "special" file permissions for all of these attributes.

In driver/staging/most/usb/usb.c I can't use the DEVICE_ATTR_*
macros, unless we are willing to add a couple of extra function
wrappers. This is because I am using the same show and store
functions for all the attributes.

regards,
Chris


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

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

* Re: [PATCH 00/50] staging: most: rework driver architecture and fix defects
  2017-11-27 13:38   ` Christian Gromm
@ 2017-11-27 15:07     ` Greg KH
  0 siblings, 0 replies; 68+ messages in thread
From: Greg KH @ 2017-11-27 15:07 UTC (permalink / raw)
  To: Christian Gromm; +Cc: driverdev-devel

On Mon, Nov 27, 2017 at 02:38:34PM +0100, Christian Gromm wrote:
> On 24.11.2017 16:31, Greg KH wrote:
> > On Tue, Nov 21, 2017 at 03:04:34PM +0100, Christian Gromm wrote:
> > > This patch set fixes bugs and integrates the driver to the kernel's device
> > > model by revising its architecture. Part of this change is rearranging the
> > > directory layout, renaming of files and folders and thereby creating a
> > > clean driver structure.
> > 
> > Ok I've now applied all of these to my testing branch.  I think you need
> > to make some follow-up patches:
> > 	- fix the build to actually compile the individual drivers :)
> > 	- make DEVICE_ATTR structures static
> > 	- use ATTRIBUTE_GROUPS where you can
> > 	- use DEVICE_ATTR_RW() and _RO and _WO instead of a "raw"
> > 	  DEVICE_ATTR() call.  There should not be any need to be having
> > 	  any "special" file permissions for all of these attributes.
> 
> In driver/staging/most/usb/usb.c I can't use the DEVICE_ATTR_*
> macros, unless we are willing to add a couple of extra function
> wrappers. This is because I am using the same show and store
> functions for all the attributes.

Ok, try to use them as much as possible, I'll review the remaining ones
when you feel the code is ready for another review cycle.

thanks,

greg k-h

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

end of thread, other threads:[~2017-11-27 15:07 UTC | newest]

Thread overview: 68+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-21 14:04 [PATCH 00/50] staging: most: rework driver architecture and fix defects Christian Gromm
2017-11-21 14:04 ` [PATCH 01/50] staging: most: move core files Christian Gromm
2017-11-21 14:04 ` [PATCH 02/50] staging: most: cdev: rename module Christian Gromm
2017-11-21 14:04 ` [PATCH 03/50] staging: most: i2c: " Christian Gromm
2017-11-21 14:04 ` [PATCH 04/50] staging: most: dim2: " Christian Gromm
2017-11-21 14:04 ` [PATCH 05/50] staging: most: net: " Christian Gromm
2017-11-21 14:04 ` [PATCH 06/50] staging: most: sound: " Christian Gromm
2017-11-21 14:04 ` [PATCH 07/50] staging: most: usb: " Christian Gromm
2017-11-21 14:04 ` [PATCH 08/50] staging: most: video: " Christian Gromm
2017-11-24 15:08   ` Greg KH
2017-11-21 14:04 ` [PATCH 09/50] staging: most: remove proprietary kobjects Christian Gromm
2017-11-24 15:19   ` Greg KH
2017-11-21 14:04 ` [PATCH 10/50] staging: most: core: remove function get_channel_by_iface Christian Gromm
2017-11-22 10:44   ` Frans Klaver
2017-11-21 14:04 ` [PATCH 11/50] staging: most: core: add a match function for the bus Christian Gromm
2017-11-21 14:04 ` [PATCH 12/50] staging: most: core: encapsulate code in function Christian Gromm
2017-11-21 14:04 ` [PATCH 13/50] staging: most: core: rename structure Christian Gromm
2017-11-21 14:04 ` [PATCH 14/50] staging: most: core: rename struct most_c_aim_obj to pipe Christian Gromm
2017-11-21 14:04 ` [PATCH 15/50] staging: most: core: rename struct memeber Christian Gromm
2017-11-21 14:04 ` [PATCH 16/50] staging: most: core: rename members aim* of struct most_channel Christian Gromm
2017-11-21 14:04 ` [PATCH 17/50] staging: most: core: use structure to pack driver specific data Christian Gromm
2017-11-21 14:04 ` [PATCH 18/50] staging: most: core: track aim modules with linked list Christian Gromm
2017-11-21 14:04 ` [PATCH 19/50] staging: most: core: fix sysfs attribute management Christian Gromm
2017-11-21 14:04 ` [PATCH 20/50] staging: most: core: remove struct device Christian Gromm
2017-11-22 13:01   ` PrasannaKumar Muralidharan
2017-11-24 15:10     ` Greg KH
2017-11-24 15:20       ` Greg KH
2017-11-21 14:04 ` [PATCH 21/50] staging: most: core: rename function Christian Gromm
2017-11-21 14:04 ` [PATCH 22/50] staging: most: core: replace struct most_inst_obj Christian Gromm
2017-11-21 14:04 ` [PATCH 23/50] staging: most: core: put channel name in struct most_channel Christian Gromm
2017-11-21 14:04 ` [PATCH 24/50] staging: most: core: remove context pointer Christian Gromm
2017-11-21 14:04 ` [PATCH 25/50] staging: most: usb: remove pointer initialization Christian Gromm
2017-11-21 14:05 ` [PATCH 26/50] staging: most: rename struct most_aim Christian Gromm
2017-11-22 13:01   ` PrasannaKumar Muralidharan
2017-11-21 14:05 ` [PATCH 27/50] staging: most: rename functions to register a driver with most_core Christian Gromm
2017-11-21 14:05 ` [PATCH 28/50] staging: most: core: rename mod_list Christian Gromm
2017-11-21 14:05 ` [PATCH 29/50] staging: most: core: rename aim variables Christian Gromm
2017-11-21 14:05 ` [PATCH 30/50] staging: most: core: rename function link_channel_to_aim Christian Gromm
2017-11-21 14:05 ` [PATCH 31/50] staging: most: net: remove aim designators Christian Gromm
2017-11-21 14:05 ` [PATCH 32/50] staging: most: sound: remove aim designator Christian Gromm
2017-11-21 14:05 ` [PATCH 33/50] staging: most: video: remove aim designators Christian Gromm
2017-11-21 14:05 ` [PATCH 34/50] staging: most: cdev: rename struct aim_channel Christian Gromm
2017-11-21 14:05 ` [PATCH 35/50] staging: most: cdev: rename variable aim_devno Christian Gromm
2017-11-21 14:05 ` [PATCH 36/50] staging: most: cdev: rename class instance aim_class Christian Gromm
2017-11-21 14:05 ` [PATCH 37/50] staging: most: cdev: rename variable cdev_aim Christian Gromm
2017-11-21 14:05 ` [PATCH 38/50] staging: most: fix comment sections Christian Gromm
2017-11-21 14:05 ` [PATCH 39/50] staging: most: core: denote modules as components Christian Gromm
2017-11-21 14:05 ` [PATCH 40/50] staging: most: core: fix formatting Christian Gromm
2017-11-21 14:05 ` [PATCH 41/50] staging: most: usb: clear functional stall on OUT endpoint Christian Gromm
2017-11-22 13:01   ` PrasannaKumar Muralidharan
2017-11-21 14:05 ` [PATCH 42/50] staging: most: core: fix data type Christian Gromm
2017-11-22 13:02   ` PrasannaKumar Muralidharan
2017-11-24 15:09   ` Greg KH
2017-11-21 14:05 ` [PATCH 43/50] staging: most: core: check value returned by match function Christian Gromm
2017-11-21 14:05 ` [PATCH 44/50] staging: most: update driver usage file Christian Gromm
2017-11-21 14:05 ` [PATCH 45/50] staging: most: cdev: replace function prefix Christian Gromm
2017-11-21 14:05 ` [PATCH 46/50] staging: most: cdev: bundle module variables in structure Christian Gromm
2017-11-21 14:05 ` [PATCH 47/50] staging: most: core: remove class generation Christian Gromm
2017-11-22 13:02   ` PrasannaKumar Muralidharan
2017-11-21 14:05 ` [PATCH 48/50] staging: most: core: fix list traversing Christian Gromm
2017-11-21 14:05 ` [PATCH 49/50] staging: most: add ABI documentation Christian Gromm
2017-11-21 14:05 ` [PATCH 50/50] staging: most: usb: fix show/store function names Christian Gromm
2017-11-22 13:00 ` [PATCH 00/50] staging: most: rework driver architecture and fix defects PrasannaKumar Muralidharan
2017-11-24 15:11   ` Greg KH
2017-11-24 15:31 ` Greg KH
2017-11-24 15:46   ` Christian Gromm
2017-11-27 13:38   ` Christian Gromm
2017-11-27 15:07     ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.