linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] spi: lm70llp: remove multiple blank lines
@ 2015-12-03 12:59 Sudip Mukherjee
       [not found] ` <1449147599-26705-1-git-send-email-sudipm.mukherjee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Sudip Mukherjee @ 2015-12-03 12:59 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA, Sudip Mukherjee

checkpatch complains about multiple blank lines.

Signed-off-by: Sudip Mukherjee <sudip-ofJRbWXBVFamYgehrs7/Lw@public.gmane.org>
---
 drivers/spi/spi-lm70llp.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/spi/spi-lm70llp.c b/drivers/spi/spi-lm70llp.c
index ba72347..eb4b421 100644
--- a/drivers/spi/spi-lm70llp.c
+++ b/drivers/spi/spi-lm70llp.c
@@ -23,11 +23,9 @@
 #include <linux/sysfs.h>
 #include <linux/workqueue.h>
 
-
 #include <linux/spi/spi.h>
 #include <linux/spi/spi_bitbang.h>
 
-
 /*
  * The LM70 communicates with a host processor using a 3-wire variant of
  * the SPI/Microwire bus interface. This driver specifically supports an
@@ -88,7 +86,6 @@ struct spi_lm70llp {
 /* REVISIT : ugly global ; provides "exclusive open" facility */
 static struct spi_lm70llp *lm70llp;
 
-
 /*-------------------------------------------------------------------*/
 
 static inline struct spi_lm70llp *spidev_to_pp(struct spi_device *spi)
@@ -319,7 +316,6 @@ static void spi_lm70llp_detach(struct parport *p)
 	lm70llp = NULL;
 }
 
-
 static struct parport_driver spi_lm70llp_drv = {
 	.name =		DRVNAME,
 	.attach =	spi_lm70llp_attach,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/7] spi: lm70llp: add blank line after declaration
       [not found] ` <1449147599-26705-1-git-send-email-sudipm.mukherjee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-12-03 12:59   ` Sudip Mukherjee
  0 siblings, 0 replies; 8+ messages in thread
From: Sudip Mukherjee @ 2015-12-03 12:59 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA, Sudip Mukherjee

checkpatch complains about missing blank line after declaration.

Signed-off-by: Sudip Mukherjee <sudip-ofJRbWXBVFamYgehrs7/Lw@public.gmane.org>
---
 drivers/spi/spi-lm70llp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/spi/spi-lm70llp.c b/drivers/spi/spi-lm70llp.c
index eb4b421..7037028 100644
--- a/drivers/spi/spi-lm70llp.c
+++ b/drivers/spi/spi-lm70llp.c
@@ -119,12 +119,14 @@ static inline void assertCS(struct spi_lm70llp *pp)
 static inline void clkHigh(struct spi_lm70llp *pp)
 {
 	u8 data = parport_read_data(pp->port);
+
 	parport_write_data(pp->port, data | SCLK);
 }
 
 static inline void clkLow(struct spi_lm70llp *pp)
 {
 	u8 data = parport_read_data(pp->port);
+
 	parport_write_data(pp->port, data & ~SCLK);
 }
 
@@ -163,8 +165,10 @@ static inline void setmosi(struct spi_device *s, int is_on)
 static inline int getmiso(struct spi_device *s)
 {
 	struct spi_lm70llp *pp = spidev_to_pp(s);
+
 	return ((SIO == (parport_read_status(pp->port) & SIO)) ? 0 : 1 );
 }
+
 /*--------------------------------------------------------------------*/
 
 #include "spi-bitbang-txrx.h"
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 3/7] spi: lm70llp: remove cast to void
  2015-12-03 12:59 [PATCH 1/7] spi: lm70llp: remove multiple blank lines Sudip Mukherjee
       [not found] ` <1449147599-26705-1-git-send-email-sudipm.mukherjee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-12-03 12:59 ` Sudip Mukherjee
  2015-12-03 12:59 ` [PATCH 4/7] spi: lm70llp: correct alignment Sudip Mukherjee
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Sudip Mukherjee @ 2015-12-03 12:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, linux-spi, Sudip Mukherjee

checkpatch was complaining about space after cast. But the cast to void
is not required at that place.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/spi/spi-lm70llp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-lm70llp.c b/drivers/spi/spi-lm70llp.c
index 7037028..133e76c 100644
--- a/drivers/spi/spi-lm70llp.c
+++ b/drivers/spi/spi-lm70llp.c
@@ -294,7 +294,7 @@ out_off_and_release:
 out_parport_unreg:
 	parport_unregister_device(pd);
 out_free_master:
-	(void) spi_master_put(master);
+	spi_master_put(master);
 out_fail:
 	pr_info("%s: spi_lm70llp probe fail, status %d\n", DRVNAME, status);
 }
@@ -315,7 +315,7 @@ static void spi_lm70llp_detach(struct parport *p)
 	parport_release(pp->pd);
 	parport_unregister_device(pp->pd);
 
-	(void) spi_master_put(pp->bitbang.master);
+	spi_master_put(pp->bitbang.master);
 
 	lm70llp = NULL;
 }
-- 
1.9.1

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

* [PATCH 4/7] spi: lm70llp: correct alignment
  2015-12-03 12:59 [PATCH 1/7] spi: lm70llp: remove multiple blank lines Sudip Mukherjee
       [not found] ` <1449147599-26705-1-git-send-email-sudipm.mukherjee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2015-12-03 12:59 ` [PATCH 3/7] spi: lm70llp: remove cast to void Sudip Mukherjee
@ 2015-12-03 12:59 ` Sudip Mukherjee
  2015-12-03 12:59 ` [PATCH 5/7] spi: lm70llp: remove space Sudip Mukherjee
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Sudip Mukherjee @ 2015-12-03 12:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, linux-spi, Sudip Mukherjee

checkpatch complains about the allignment with open parenthesis.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/spi/spi-lm70llp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-lm70llp.c b/drivers/spi/spi-lm70llp.c
index 133e76c..5f526ce 100644
--- a/drivers/spi/spi-lm70llp.c
+++ b/drivers/spi/spi-lm70llp.c
@@ -229,8 +229,8 @@ static void spi_lm70llp_attach(struct parport *p)
 	 */
 	pp->port = p;
 	pd = parport_register_device(p, DRVNAME,
-			NULL, NULL, NULL,
-			PARPORT_FLAG_EXCL, pp);
+				     NULL, NULL, NULL,
+				     PARPORT_FLAG_EXCL, pp);
 	if (!pd) {
 		status = -ENOMEM;
 		goto out_free_master;
@@ -273,7 +273,7 @@ static void spi_lm70llp_attach(struct parport *p)
 	pp->spidev_lm70 = spi_new_device(pp->bitbang.master, &pp->info);
 	if (pp->spidev_lm70)
 		dev_dbg(&pp->spidev_lm70->dev, "spidev_lm70 at %s\n",
-				dev_name(&pp->spidev_lm70->dev));
+			dev_name(&pp->spidev_lm70->dev));
 	else {
 		printk(KERN_WARNING "%s: spi_new_device failed\n", DRVNAME);
 		status = -ENODEV;
-- 
1.9.1

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

* [PATCH 5/7] spi: lm70llp: remove space
  2015-12-03 12:59 [PATCH 1/7] spi: lm70llp: remove multiple blank lines Sudip Mukherjee
                   ` (2 preceding siblings ...)
  2015-12-03 12:59 ` [PATCH 4/7] spi: lm70llp: correct alignment Sudip Mukherjee
@ 2015-12-03 12:59 ` Sudip Mukherjee
  2015-12-03 12:59 ` [PATCH 6/7] spi: lm70llp: remove printk Sudip Mukherjee
  2015-12-03 12:59 ` [PATCH 7/7] spi: lm70llp: use new parport device model Sudip Mukherjee
  5 siblings, 0 replies; 8+ messages in thread
From: Sudip Mukherjee @ 2015-12-03 12:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, linux-spi, Sudip Mukherjee

checkpatch complains about space before closing brace.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/spi/spi-lm70llp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-lm70llp.c b/drivers/spi/spi-lm70llp.c
index 5f526ce..62d0f6d 100644
--- a/drivers/spi/spi-lm70llp.c
+++ b/drivers/spi/spi-lm70llp.c
@@ -166,7 +166,7 @@ static inline int getmiso(struct spi_device *s)
 {
 	struct spi_lm70llp *pp = spidev_to_pp(s);
 
-	return ((SIO == (parport_read_status(pp->port) & SIO)) ? 0 : 1 );
+	return ((SIO == (parport_read_status(pp->port) & SIO)) ? 0 : 1);
 }
 
 /*--------------------------------------------------------------------*/
-- 
1.9.1

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

* [PATCH 6/7] spi: lm70llp: remove printk
  2015-12-03 12:59 [PATCH 1/7] spi: lm70llp: remove multiple blank lines Sudip Mukherjee
                   ` (3 preceding siblings ...)
  2015-12-03 12:59 ` [PATCH 5/7] spi: lm70llp: remove space Sudip Mukherjee
@ 2015-12-03 12:59 ` Sudip Mukherjee
       [not found]   ` <1449147599-26705-6-git-send-email-sudipm.mukherjee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2015-12-03 12:59 ` [PATCH 7/7] spi: lm70llp: use new parport device model Sudip Mukherjee
  5 siblings, 1 reply; 8+ messages in thread
From: Sudip Mukherjee @ 2015-12-03 12:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, linux-spi, Sudip Mukherjee

Using pr_* macros are more prefferable than using printk. Start using
pr_* family of macros and define pr_fmt to be used with it.
While at it remove DRVNAME from an existing pr_info() as the name is now
being printed by pr_fmt.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/spi/spi-lm70llp.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-lm70llp.c b/drivers/spi/spi-lm70llp.c
index 62d0f6d..39cf5dc 100644
--- a/drivers/spi/spi-lm70llp.c
+++ b/drivers/spi/spi-lm70llp.c
@@ -13,6 +13,7 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/init.h>
 #include <linux/module.h>
@@ -199,9 +200,7 @@ static void spi_lm70llp_attach(struct parport *p)
 	int			status;
 
 	if (lm70llp) {
-		printk(KERN_WARNING
-			"%s: spi_lm70llp instance already loaded. Aborting.\n",
-			DRVNAME);
+		pr_warn("spi_lm70llp instance already loaded. Aborting.\n");
 		return;
 	}
 
@@ -246,9 +245,7 @@ static void spi_lm70llp_attach(struct parport *p)
 	 */
 	status = spi_bitbang_start(&pp->bitbang);
 	if (status < 0) {
-		printk(KERN_WARNING
-			"%s: spi_bitbang_start failed with status %d\n",
-			DRVNAME, status);
+		pr_warn("spi_bitbang_start failed with status %d\n", status);
 		goto out_off_and_release;
 	}
 
@@ -275,7 +272,7 @@ static void spi_lm70llp_attach(struct parport *p)
 		dev_dbg(&pp->spidev_lm70->dev, "spidev_lm70 at %s\n",
 			dev_name(&pp->spidev_lm70->dev));
 	else {
-		printk(KERN_WARNING "%s: spi_new_device failed\n", DRVNAME);
+		pr_warn("spi_new_device failed\n");
 		status = -ENODEV;
 		goto out_bitbang_stop;
 	}
@@ -296,7 +293,7 @@ out_parport_unreg:
 out_free_master:
 	spi_master_put(master);
 out_fail:
-	pr_info("%s: spi_lm70llp probe fail, status %d\n", DRVNAME, status);
+	pr_info("spi_lm70llp probe fail, status %d\n", status);
 }
 
 static void spi_lm70llp_detach(struct parport *p)
-- 
1.9.1

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

* [PATCH 7/7] spi: lm70llp: use new parport device model
  2015-12-03 12:59 [PATCH 1/7] spi: lm70llp: remove multiple blank lines Sudip Mukherjee
                   ` (4 preceding siblings ...)
  2015-12-03 12:59 ` [PATCH 6/7] spi: lm70llp: remove printk Sudip Mukherjee
@ 2015-12-03 12:59 ` Sudip Mukherjee
  5 siblings, 0 replies; 8+ messages in thread
From: Sudip Mukherjee @ 2015-12-03 12:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, linux-spi, Sudip Mukherjee

Modify spi-lm70llp driver to use the new parallel port device model.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/spi/spi-lm70llp.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-lm70llp.c b/drivers/spi/spi-lm70llp.c
index 39cf5dc..9537248 100644
--- a/drivers/spi/spi-lm70llp.c
+++ b/drivers/spi/spi-lm70llp.c
@@ -198,6 +198,7 @@ static void spi_lm70llp_attach(struct parport *p)
 	struct spi_lm70llp	*pp;
 	struct spi_master	*master;
 	int			status;
+	struct pardev_cb	lm70llp_cb;
 
 	if (lm70llp) {
 		pr_warn("spi_lm70llp instance already loaded. Aborting.\n");
@@ -227,9 +228,11 @@ static void spi_lm70llp_attach(struct parport *p)
 	 * Parport hookup
 	 */
 	pp->port = p;
-	pd = parport_register_device(p, DRVNAME,
-				     NULL, NULL, NULL,
-				     PARPORT_FLAG_EXCL, pp);
+	memset(&lm70llp_cb, 0, sizeof(lm70llp_cb));
+	lm70llp_cb.private = pp;
+	lm70llp_cb.flags = PARPORT_FLAG_EXCL;
+	pd = parport_register_dev_model(p, DRVNAME, &lm70llp_cb, 0);
+
 	if (!pd) {
 		status = -ENOMEM;
 		goto out_free_master;
@@ -319,8 +322,9 @@ static void spi_lm70llp_detach(struct parport *p)
 
 static struct parport_driver spi_lm70llp_drv = {
 	.name =		DRVNAME,
-	.attach =	spi_lm70llp_attach,
+	.match_port =	spi_lm70llp_attach,
 	.detach =	spi_lm70llp_detach,
+	.devmodel =	true,
 };
 
 static int __init init_spi_lm70llp(void)
-- 
1.9.1

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

* Re: [PATCH 6/7] spi: lm70llp: remove printk
       [not found]   ` <1449147599-26705-6-git-send-email-sudipm.mukherjee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-12-04 12:16     ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2015-12-04 12:16 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 768 bytes --]

On Thu, Dec 03, 2015 at 06:29:58PM +0530, Sudip Mukherjee wrote:
> Using pr_* macros are more prefferable than using printk. Start using
> pr_* family of macros and define pr_fmt to be used with it.
> While at it remove DRVNAME from an existing pr_info() as the name is now
> being printed by pr_fmt.

> @@ -246,9 +245,7 @@ static void spi_lm70llp_attach(struct parport *p)
>  	 */
>  	status = spi_bitbang_start(&pp->bitbang);
>  	if (status < 0) {
> -		printk(KERN_WARNING
> -			"%s: spi_bitbang_start failed with status %d\n",
> -			DRVNAME, status);
> +		pr_warn("spi_bitbang_start failed with status %d\n", status);
>  		goto out_off_and_release;
>  	}
>  

When we have a struct device available it's even better to use
dev_warn() and so on.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2015-12-04 12:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-03 12:59 [PATCH 1/7] spi: lm70llp: remove multiple blank lines Sudip Mukherjee
     [not found] ` <1449147599-26705-1-git-send-email-sudipm.mukherjee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-12-03 12:59   ` [PATCH 2/7] spi: lm70llp: add blank line after declaration Sudip Mukherjee
2015-12-03 12:59 ` [PATCH 3/7] spi: lm70llp: remove cast to void Sudip Mukherjee
2015-12-03 12:59 ` [PATCH 4/7] spi: lm70llp: correct alignment Sudip Mukherjee
2015-12-03 12:59 ` [PATCH 5/7] spi: lm70llp: remove space Sudip Mukherjee
2015-12-03 12:59 ` [PATCH 6/7] spi: lm70llp: remove printk Sudip Mukherjee
     [not found]   ` <1449147599-26705-6-git-send-email-sudipm.mukherjee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-12-04 12:16     ` Mark Brown
2015-12-03 12:59 ` [PATCH 7/7] spi: lm70llp: use new parport device model Sudip Mukherjee

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