Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1503836 > unrolled thread

[char-misc-next 0/5] mei: mei client bus api changes

Started byTomas Winkler <tomas.winkler@intel.com>
First post2016-10-19 17:10 +0200
Last post2016-10-19 17:50 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [char-misc-next 0/5] mei: mei client bus api changes Tomas Winkler <tomas.winkler@intel.com> - 2016-10-19 17:10 +0200
    [char-misc-next 2/5] watchdog: mei_wdt: use module_mei_cl_driver macro Tomas Winkler <tomas.winkler@intel.com> - 2016-10-19 17:10 +0200
      Re: [char-misc-next 2/5] watchdog: mei_wdt: use module_mei_cl_driver  macro Guenter Roeck <linux@roeck-us.net> - 2016-10-20 03:50 +0200
    [char-misc-next 3/5] nfc: mei: use module_mei_cl_driver macro Tomas Winkler <tomas.winkler@intel.com> - 2016-10-19 17:10 +0200
    [char-misc-next 4/5] nfc: mei_phy: get phy from the driver data Tomas Winkler <tomas.winkler@intel.com> - 2016-10-19 17:50 +0200

#1503836 — [char-misc-next 0/5] mei: mei client bus api changes

FromTomas Winkler <tomas.winkler@intel.com>
Date2016-10-19 17:10 +0200
Subject[char-misc-next 0/5] mei: mei client bus api changes
Message-ID<su0Fc-2Wq-31@gated-at.bofh.it>
We are adding a helper module macro for removing boilerplate  
code in driver registration, and removing redundant context
argument from the event callback.

The changes go over misc, nfc, and watchdog subtrees. 
I believe it should be conflict free to merge it to the misc
tree.

Tomas Winkler (5):
  mei: bus: add  module_mei_cl_driver helper macro
  watchdog: mei_wdt: use module_mei_cl_driver macro
  nfc: mei: use module_mei_cl_driver macro
  nfc: mei_phy: get phy from the driver data
  mei: bus: remove rx callback context

 drivers/misc/mei/bus.c      |  6 ++----
 drivers/nfc/mei_phy.c       | 10 ++++++----
 drivers/nfc/microread/mei.c | 23 +----------------------
 drivers/nfc/pn544/mei.c     | 23 +----------------------
 drivers/watchdog/mei_wdt.c  | 26 +++-----------------------
 include/linux/mei_cl_bus.h  | 19 +++++++++++++++----
 6 files changed, 28 insertions(+), 79 deletions(-)

-- 
2.7.4

[toc] | [next] | [standalone]


#1503840 — [char-misc-next 2/5] watchdog: mei_wdt: use module_mei_cl_driver macro

FromTomas Winkler <tomas.winkler@intel.com>
Date2016-10-19 17:10 +0200
Subject[char-misc-next 2/5] watchdog: mei_wdt: use module_mei_cl_driver macro
Message-ID<su0Fe-2Wq-87@gated-at.bofh.it>
In reply to#1503836
Replace boilerplate driver registration with module_mei_cl_driver macro.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/watchdog/mei_wdt.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/drivers/watchdog/mei_wdt.c b/drivers/watchdog/mei_wdt.c
index 630bd189f167..116be477c8fd 100644
--- a/drivers/watchdog/mei_wdt.c
+++ b/drivers/watchdog/mei_wdt.c
@@ -699,25 +699,7 @@ static struct mei_cl_driver mei_wdt_driver = {
 	.remove = mei_wdt_remove,
 };
 
-static int __init mei_wdt_init(void)
-{
-	int ret;
-
-	ret = mei_cldev_driver_register(&mei_wdt_driver);
-	if (ret) {
-		pr_err(KBUILD_MODNAME ": module registration failed\n");
-		return ret;
-	}
-	return 0;
-}
-
-static void __exit mei_wdt_exit(void)
-{
-	mei_cldev_driver_unregister(&mei_wdt_driver);
-}
-
-module_init(mei_wdt_init);
-module_exit(mei_wdt_exit);
+module_mei_cl_driver(mei_wdt_driver);
 
 MODULE_AUTHOR("Intel Corporation");
 MODULE_LICENSE("GPL");
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1504453 — Re: [char-misc-next 2/5] watchdog: mei_wdt: use module_mei_cl_driver macro

FromGuenter Roeck <linux@roeck-us.net>
Date2016-10-20 03:50 +0200
SubjectRe: [char-misc-next 2/5] watchdog: mei_wdt: use module_mei_cl_driver macro
Message-ID<suaEy-Sb-5@gated-at.bofh.it>
In reply to#1503840
On 10/19/2016 06:33 AM, Tomas Winkler wrote:
> Replace boilerplate driver registration with module_mei_cl_driver macro.
>
> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>

Acked-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/mei_wdt.c | 20 +-------------------
>  1 file changed, 1 insertion(+), 19 deletions(-)
>
> diff --git a/drivers/watchdog/mei_wdt.c b/drivers/watchdog/mei_wdt.c
> index 630bd189f167..116be477c8fd 100644
> --- a/drivers/watchdog/mei_wdt.c
> +++ b/drivers/watchdog/mei_wdt.c
> @@ -699,25 +699,7 @@ static struct mei_cl_driver mei_wdt_driver = {
>  	.remove = mei_wdt_remove,
>  };
>
> -static int __init mei_wdt_init(void)
> -{
> -	int ret;
> -
> -	ret = mei_cldev_driver_register(&mei_wdt_driver);
> -	if (ret) {
> -		pr_err(KBUILD_MODNAME ": module registration failed\n");
> -		return ret;
> -	}
> -	return 0;
> -}
> -
> -static void __exit mei_wdt_exit(void)
> -{
> -	mei_cldev_driver_unregister(&mei_wdt_driver);
> -}
> -
> -module_init(mei_wdt_init);
> -module_exit(mei_wdt_exit);
> +module_mei_cl_driver(mei_wdt_driver);
>
>  MODULE_AUTHOR("Intel Corporation");
>  MODULE_LICENSE("GPL");
>

[toc] | [prev] | [next] | [standalone]


#1503849 — [char-misc-next 3/5] nfc: mei: use module_mei_cl_driver macro

FromTomas Winkler <tomas.winkler@intel.com>
Date2016-10-19 17:10 +0200
Subject[char-misc-next 3/5] nfc: mei: use module_mei_cl_driver macro
Message-ID<su0Fe-2Wq-103@gated-at.bofh.it>
In reply to#1503836
Replace boilerplate driver registration with module_mei_cl_driver
macro in pn544 and microread devices.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/nfc/microread/mei.c | 23 +----------------------
 drivers/nfc/pn544/mei.c     | 23 +----------------------
 2 files changed, 2 insertions(+), 44 deletions(-)

diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c
index 3092501f26c4..eb5eddf1794e 100644
--- a/drivers/nfc/microread/mei.c
+++ b/drivers/nfc/microread/mei.c
@@ -82,28 +82,7 @@ static struct mei_cl_driver microread_driver = {
 	.remove = microread_mei_remove,
 };
 
-static int microread_mei_init(void)
-{
-	int r;
-
-	pr_debug(DRIVER_DESC ": %s\n", __func__);
-
-	r = mei_cldev_driver_register(&microread_driver);
-	if (r) {
-		pr_err(MICROREAD_DRIVER_NAME ": driver registration failed\n");
-		return r;
-	}
-
-	return 0;
-}
-
-static void microread_mei_exit(void)
-{
-	mei_cldev_driver_unregister(&microread_driver);
-}
-
-module_init(microread_mei_init);
-module_exit(microread_mei_exit);
+module_mei_cl_driver(microread_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/nfc/pn544/mei.c b/drivers/nfc/pn544/mei.c
index 46d0eb24eef9..ad57a8ec00d6 100644
--- a/drivers/nfc/pn544/mei.c
+++ b/drivers/nfc/pn544/mei.c
@@ -82,28 +82,7 @@ static struct mei_cl_driver pn544_driver = {
 	.remove = pn544_mei_remove,
 };
 
-static int pn544_mei_init(void)
-{
-	int r;
-
-	pr_debug(DRIVER_DESC ": %s\n", __func__);
-
-	r = mei_cldev_driver_register(&pn544_driver);
-	if (r) {
-		pr_err(PN544_DRIVER_NAME ": driver registration failed\n");
-		return r;
-	}
-
-	return 0;
-}
-
-static void pn544_mei_exit(void)
-{
-	mei_cldev_driver_unregister(&pn544_driver);
-}
-
-module_init(pn544_mei_init);
-module_exit(pn544_mei_exit);
+module_mei_cl_driver(pn544_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION(DRIVER_DESC);
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1503960 — [char-misc-next 4/5] nfc: mei_phy: get phy from the driver data

FromTomas Winkler <tomas.winkler@intel.com>
Date2016-10-19 17:50 +0200
Subject[char-misc-next 4/5] nfc: mei_phy: get phy from the driver data
Message-ID<su1hV-3b7-39@gated-at.bofh.it>
In reply to#1503836
In order to remove rather redundant context from the callback
signature we the get nfc mei_phy from the driver's data.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/nfc/mei_phy.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/nfc/mei_phy.c b/drivers/nfc/mei_phy.c
index 83deda4bb4d6..66dfd81ffb18 100644
--- a/drivers/nfc/mei_phy.c
+++ b/drivers/nfc/mei_phy.c
@@ -300,7 +300,10 @@ static int mei_nfc_recv(struct nfc_mei_phy *phy, u8 *buf, size_t length)
 static void nfc_mei_event_cb(struct mei_cl_device *cldev, u32 events,
 			     void *context)
 {
-	struct nfc_mei_phy *phy = context;
+	struct nfc_mei_phy *phy = mei_cldev_get_drvdata(cldev);
+
+	if (!phy)
+		return;
 
 	if (phy->hard_fault != 0)
 		return;
-- 
2.7.4

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web