Linux-ARM-MSM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/7] Improvements to MHI Bus
@ 2020-03-23 12:21 Manivannan Sadhasivam
  2020-03-23 12:21 ` [PATCH 1/7] bus: mhi: core: Pass module owner during client driver registration Manivannan Sadhasivam
  0 siblings, 1 reply; 3+ messages in thread
From: Manivannan Sadhasivam @ 2020-03-23 12:21 UTC (permalink / raw)
  To: gregkh, davem
  Cc: smohanad, jhugo, kvalo, bjorn.andersson, hemantk, linux-arm-msm,
	linux-kernel, Manivannan Sadhasivam

Hi Greg,

Here is the patchset for improving the MHI bus support. One of the patch
is suggested by you for adding the driver owner field and rest are additional
improvements and some fixes.

I've also included the remaining networking patches from previous patch series
which needs review from Dave. Dave could you please look into those 2 patches
which falls under net subsystem? Greg can take those 2 if an Ack is provided.

Thanks,
Mani

Manivannan Sadhasivam (7):
  bus: mhi: core: Pass module owner during client driver registration
  bus: mhi: core: Add support for reading MHI info from device
  bus: mhi: core: Initialize bhie field in mhi_cntrl for RDDM capture
  bus: mhi: core: Drop the references to mhi_dev in mhi_destroy_device()
  bus: mhi: core: Add support for MHI suspend and resume
  net: qrtr: Add MHI transport layer
  net: qrtr: Do not depend on ARCH_QCOM

 drivers/bus/mhi/core/init.c     |  39 +++++-
 drivers/bus/mhi/core/internal.h |  10 ++
 drivers/bus/mhi/core/main.c     |  16 ++-
 drivers/bus/mhi/core/pm.c       | 143 ++++++++++++++++++++++
 include/linux/mhi.h             |  46 ++++++-
 net/qrtr/Kconfig                |   8 +-
 net/qrtr/Makefile               |   2 +
 net/qrtr/mhi.c                  | 208 ++++++++++++++++++++++++++++++++
 8 files changed, 464 insertions(+), 8 deletions(-)
 create mode 100644 net/qrtr/mhi.c

-- 
2.17.1


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

* [PATCH 1/7] bus: mhi: core: Pass module owner during client driver registration
  2020-03-23 12:21 [PATCH 0/7] Improvements to MHI Bus Manivannan Sadhasivam
@ 2020-03-23 12:21 ` Manivannan Sadhasivam
  2020-03-23 19:05   ` Bjorn Andersson
  0 siblings, 1 reply; 3+ messages in thread
From: Manivannan Sadhasivam @ 2020-03-23 12:21 UTC (permalink / raw)
  To: gregkh, davem
  Cc: smohanad, jhugo, kvalo, bjorn.andersson, hemantk, linux-arm-msm,
	linux-kernel, Manivannan Sadhasivam

The module owner field can be used to prevent the removal of kernel
modules when there are any device files associated with it opened in
userspace. Hence, modify the API to pass module owner field. For
convenience, module_mhi_driver() macro is used which takes care of
passing the module owner through THIS_MODULE of the module of the
driver and also avoiding the use of specifying the default MHI client
driver register/unregister routines.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/bus/mhi/core/init.c |  5 +++--
 include/linux/mhi.h         | 19 ++++++++++++++++++-
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
index 5fb756ca335e..eb7f556a8531 100644
--- a/drivers/bus/mhi/core/init.c
+++ b/drivers/bus/mhi/core/init.c
@@ -1189,7 +1189,7 @@ static int mhi_driver_remove(struct device *dev)
 	return 0;
 }
 
-int mhi_driver_register(struct mhi_driver *mhi_drv)
+int __mhi_driver_register(struct mhi_driver *mhi_drv, struct module *owner)
 {
 	struct device_driver *driver = &mhi_drv->driver;
 
@@ -1197,12 +1197,13 @@ int mhi_driver_register(struct mhi_driver *mhi_drv)
 		return -EINVAL;
 
 	driver->bus = &mhi_bus_type;
+	driver->owner = owner;
 	driver->probe = mhi_driver_probe;
 	driver->remove = mhi_driver_remove;
 
 	return driver_register(driver);
 }
-EXPORT_SYMBOL_GPL(mhi_driver_register);
+EXPORT_SYMBOL_GPL(__mhi_driver_register);
 
 void mhi_driver_unregister(struct mhi_driver *mhi_drv)
 {
diff --git a/include/linux/mhi.h b/include/linux/mhi.h
index 79cb9f898544..0e7071dbf2c3 100644
--- a/include/linux/mhi.h
+++ b/include/linux/mhi.h
@@ -514,11 +514,28 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl,
  */
 void mhi_unregister_controller(struct mhi_controller *mhi_cntrl);
 
+/*
+ * module_mhi_driver() - Helper macro for drivers that don't do
+ * anything special in module init/exit.  This eliminates a lot of
+ * boilerplate.  Each module may only use this macro once, and
+ * calling it replaces module_init() and module_exit()
+ */
+#define module_mhi_driver(mhi_drv) \
+	module_driver(mhi_drv, mhi_driver_register, \
+		      mhi_driver_unregister)
+
+/*
+ * Macro to avoid include chaining to get THIS_MODULE
+ */
+#define mhi_driver_register(mhi_drv) \
+	__mhi_driver_register(mhi_drv, THIS_MODULE)
+
 /**
  * mhi_driver_register - Register driver with MHI framework
  * @mhi_drv: Driver associated with the device
+ * @owner: The module owner
  */
-int mhi_driver_register(struct mhi_driver *mhi_drv);
+int __mhi_driver_register(struct mhi_driver *mhi_drv, struct module *owner);
 
 /**
  * mhi_driver_unregister - Unregister a driver for mhi_devices
-- 
2.17.1


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

* Re: [PATCH 1/7] bus: mhi: core: Pass module owner during client driver registration
  2020-03-23 12:21 ` [PATCH 1/7] bus: mhi: core: Pass module owner during client driver registration Manivannan Sadhasivam
@ 2020-03-23 19:05   ` Bjorn Andersson
  0 siblings, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2020-03-23 19:05 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: gregkh, davem, smohanad, jhugo, kvalo, hemantk, linux-arm-msm,
	linux-kernel

On Mon 23 Mar 05:21 PDT 2020, Manivannan Sadhasivam wrote:

> The module owner field can be used to prevent the removal of kernel
> modules when there are any device files associated with it opened in
> userspace. Hence, modify the API to pass module owner field. For
> convenience, module_mhi_driver() macro is used which takes care of
> passing the module owner through THIS_MODULE of the module of the
> driver and also avoiding the use of specifying the default MHI client
> driver register/unregister routines.
> 
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> ---
>  drivers/bus/mhi/core/init.c |  5 +++--
>  include/linux/mhi.h         | 19 ++++++++++++++++++-
>  2 files changed, 21 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
> index 5fb756ca335e..eb7f556a8531 100644
> --- a/drivers/bus/mhi/core/init.c
> +++ b/drivers/bus/mhi/core/init.c
> @@ -1189,7 +1189,7 @@ static int mhi_driver_remove(struct device *dev)
>  	return 0;
>  }
>  
> -int mhi_driver_register(struct mhi_driver *mhi_drv)
> +int __mhi_driver_register(struct mhi_driver *mhi_drv, struct module *owner)
>  {
>  	struct device_driver *driver = &mhi_drv->driver;
>  
> @@ -1197,12 +1197,13 @@ int mhi_driver_register(struct mhi_driver *mhi_drv)
>  		return -EINVAL;
>  
>  	driver->bus = &mhi_bus_type;
> +	driver->owner = owner;
>  	driver->probe = mhi_driver_probe;
>  	driver->remove = mhi_driver_remove;
>  
>  	return driver_register(driver);
>  }
> -EXPORT_SYMBOL_GPL(mhi_driver_register);
> +EXPORT_SYMBOL_GPL(__mhi_driver_register);
>  
>  void mhi_driver_unregister(struct mhi_driver *mhi_drv)
>  {
> diff --git a/include/linux/mhi.h b/include/linux/mhi.h
> index 79cb9f898544..0e7071dbf2c3 100644
> --- a/include/linux/mhi.h
> +++ b/include/linux/mhi.h
> @@ -514,11 +514,28 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl,
>   */
>  void mhi_unregister_controller(struct mhi_controller *mhi_cntrl);
>  
> +/*
> + * module_mhi_driver() - Helper macro for drivers that don't do
> + * anything special in module init/exit.  This eliminates a lot of
> + * boilerplate.  Each module may only use this macro once, and
> + * calling it replaces module_init() and module_exit()
> + */
> +#define module_mhi_driver(mhi_drv) \
> +	module_driver(mhi_drv, mhi_driver_register, \
> +		      mhi_driver_unregister)
> +
> +/*
> + * Macro to avoid include chaining to get THIS_MODULE
> + */
> +#define mhi_driver_register(mhi_drv) \
> +	__mhi_driver_register(mhi_drv, THIS_MODULE)
> +
>  /**
>   * mhi_driver_register - Register driver with MHI framework
>   * @mhi_drv: Driver associated with the device
> + * @owner: The module owner
>   */
> -int mhi_driver_register(struct mhi_driver *mhi_drv);
> +int __mhi_driver_register(struct mhi_driver *mhi_drv, struct module *owner);
>  
>  /**
>   * mhi_driver_unregister - Unregister a driver for mhi_devices
> -- 
> 2.17.1
> 

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23 12:21 [PATCH 0/7] Improvements to MHI Bus Manivannan Sadhasivam
2020-03-23 12:21 ` [PATCH 1/7] bus: mhi: core: Pass module owner during client driver registration Manivannan Sadhasivam
2020-03-23 19:05   ` Bjorn Andersson

Linux-ARM-MSM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-msm/0 linux-arm-msm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-msm linux-arm-msm/ https://lore.kernel.org/linux-arm-msm \
		linux-arm-msm@vger.kernel.org
	public-inbox-index linux-arm-msm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-arm-msm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git