Skip to contentSkip to conversation

staging: media: lirc: Resolve checkpatch issues

PATCH Superseded Namrata A Shettar 2 participants 12 messages Sep 24, 2016

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover staging: media: lirc: Resolve checkpatch issues

Fix multiple checkpatch issues.

Namrata A Shettar (6):
staging: media: lirc: Remove multiple blank lines
staging: media: lirc: Add space around '+'
staging: media: lirc: Replace data type with pointer of same type
staging: media: lirc: Add space around binary operator '+'
staging: media: lirc: Mention data type along with 'unsigned'
staging: media: lirc: Replace data type with pointer in sizeof()

 drivers/staging/media/lirc/lirc_bt829.c    |  5 +----
 drivers/staging/media/lirc/lirc_imon.c     |  6 +++---
 drivers/staging/media/lirc/lirc_parallel.c |  6 +++---
 drivers/staging/media/lirc/lirc_sasem.c    | 22 ++++++----------------
 4 files changed, 13 insertions(+), 26 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/6 staging: media: lirc: Remove multiple blank lines

Remove multiple blank lines to resolve checkpatch issue.

---
 drivers/staging/media/lirc/lirc_bt829.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/media/lirc/lirc_bt829.c +0 -3
index f740115..06eac71 100644
@@ -163,7 +163,6 @@ err_put_dev:
 	return rc;
 }
 
-
 void cleanup_module(void)
 {
 	struct pci_dev *pdev = to_pci_dev(atir_driver.dev);
@@ -174,7 +173,6 @@ void cleanup_module(void)
 	pci_dev_put(pdev);
 }
 
-
 static int atir_init_start(void)
 {
 	pci_addr_lin = ioremap(pci_addr_phys + DATA_PCI_OFF, 0x400);
@@ -190,7 +188,6 @@ static void cycle_delay(int cycle)
 	udelay(WAIT_CYCLE*cycle);
 }
 
-
 static int poll_main(void)
 {
 	unsigned char status_high, status_low;
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/6 staging: media: lirc: Add space around '+'

In reply to Namrata A Shettar

Add space around '+' to resolve checkpatch issue.

---
 drivers/staging/media/lirc/lirc_bt829.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/lirc/lirc_bt829.c +1 -1
index 06eac71..04d881b 100644
@@ -185,7 +185,7 @@ static int atir_init_start(void)
 
 static void cycle_delay(int cycle)
 {
-	udelay(WAIT_CYCLE*cycle);
+	udelay(WAIT_CYCLE * cycle);
 }
 
 static int poll_main(void)
Signature · 1 line
2.7.4
#3 lore raw

Re: [Outreachy kernel] [PATCH 2/6] staging: media: lirc: Add space around '+'

Quoted 12 lines · Namrata A Shettar

Add space around '+' to resolve checkpatch issue.

---
 drivers/staging/media/lirc/lirc_bt829.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/lirc/lirc_bt829.c +0 -0
index 06eac71..04d881b 100644

drivers/staging/media/lirc/lirc_bt829.c static int atir_init_start(void) · line 188

Quoted 5 lines
drivers/staging/media/lirc/lirc_bt829.c +1 -1
@@ -185,7 +185,7 @@ static int atir_init_start(void)
 
 static void cycle_delay(int cycle)
 {
-	udelay(WAIT_CYCLE*cycle);
+	udelay(WAIT_CYCLE * cycle);

This is not a +.

julia

Quoted 13 lines
drivers/staging/media/lirc/lirc_bt829.c +0 -1
 }
 
 static int poll_main(void)
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/d0f1bdc5ccaa602ba0a53232be35202e326e395f.1474708456.git.namrataashettar%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#4 lore raw

PATCH 3/6 staging: media: lirc: Replace data type with pointer of same type

In reply to Namrata A Shettar

Replace data type with pointer of same type in sizeof() to resolve checkpatch issue as both are of same size.

---
 drivers/staging/media/lirc/lirc_imon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/media/lirc/lirc_imon.c +3 -3
index b1c28e5..198a805 100644
@@ -702,7 +702,7 @@ static int imon_probe(struct usb_interface *interface,
 	/* prevent races probing devices w/multiple interfaces */
 	mutex_lock(&driver_lock);
 
-	context = kzalloc(sizeof(struct imon_context), GFP_KERNEL);
+	context = kzalloc(sizeof(*context), GFP_KERNEL);
 	if (!context)
 		goto driver_unlock;
 
@@ -782,11 +782,11 @@ static int imon_probe(struct usb_interface *interface,
 			__func__, vfd_proto_6p);
 	}
 
-	driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
+	driver = kzalloc(sizeof(*driver), GFP_KERNEL);
 	if (!driver)
 		goto free_context;
 
-	rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
+	rbuf = kmalloc(sizeof(*rbuf), GFP_KERNEL);
 	if (!rbuf)
 		goto free_driver;
 
Signature · 1 line
2.7.4
#5 lore raw

Re: [Outreachy kernel] [PATCH 3/6] staging: media: lirc: Replace data type with pointer of same type

Quoted 1 line · Namrata A Shettar

Replace data type with pointer of same type in sizeof() to resolve checkpatch issue as both are of same size.

There is an unnecessary double space after sizeof() in the commit message, and the message exceeds 80 characters. It is better to stop around 70 as the message will end up indented a bit in the git history.

julia

Quoted 43 lines
---
 drivers/staging/media/lirc/lirc_imon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/media/lirc/lirc_imon.c +3 -4
index b1c28e5..198a805 100644
@@ -702,7 +702,7 @@ static int imon_probe(struct usb_interface *interface,
 	/* prevent races probing devices w/multiple interfaces */
 	mutex_lock(&driver_lock);
 
-	context = kzalloc(sizeof(struct imon_context), GFP_KERNEL);
+	context = kzalloc(sizeof(*context), GFP_KERNEL);
 	if (!context)
 		goto driver_unlock;
 
@@ -782,11 +782,11 @@ static int imon_probe(struct usb_interface *interface,
 			__func__, vfd_proto_6p);
 	}
 
-	driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
+	driver = kzalloc(sizeof(*driver), GFP_KERNEL);
 	if (!driver)
 		goto free_context;
 
-	rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
+	rbuf = kmalloc(sizeof(*rbuf), GFP_KERNEL);
 	if (!rbuf)
 		goto free_driver;
 
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/328a70961fc82df3d3444f551bdf1e7ab3fc0985.1474708456.git.namrataashettar%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#6 lore raw

Re: [Outreachy kernel] [PATCH 3/6] staging: media: lirc: Replace data type with pointer of same type

In reply to Namrata A Shettar

You are also sending the patch to too many people. Not all of the listed people are maintainers of this code. See the arguments suggested to get_maintainers in the Submit a patch section of the tutorial.

julia

Quoted 44 lines · Namrata A Shettar

Replace data type with pointer of same type in sizeof() to resolve checkpatch issue as both are of same size.

---
 drivers/staging/media/lirc/lirc_imon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/media/lirc/lirc_imon.c +3 -4
index b1c28e5..198a805 100644
@@ -702,7 +702,7 @@ static int imon_probe(struct usb_interface *interface,
 	/* prevent races probing devices w/multiple interfaces */
 	mutex_lock(&driver_lock);
 
-	context = kzalloc(sizeof(struct imon_context), GFP_KERNEL);
+	context = kzalloc(sizeof(*context), GFP_KERNEL);
 	if (!context)
 		goto driver_unlock;
 
@@ -782,11 +782,11 @@ static int imon_probe(struct usb_interface *interface,
 			__func__, vfd_proto_6p);
 	}
 
-	driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
+	driver = kzalloc(sizeof(*driver), GFP_KERNEL);
 	if (!driver)
 		goto free_context;
 
-	rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
+	rbuf = kmalloc(sizeof(*rbuf), GFP_KERNEL);
 	if (!rbuf)
 		goto free_driver;
 
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/328a70961fc82df3d3444f551bdf1e7ab3fc0985.1474708456.git.namrataashettar%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#7 lore raw

PATCH 4/6 staging: media: lirc: Add space around binary operator '+'

In reply to Namrata A Shettar

Add space arounf binary operator '+' to resolve checkpatch issue.

---
 drivers/staging/media/lirc/lirc_parallel.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/media/lirc/lirc_parallel.c +3 -3
index 3906ac6..64d99ec 100644
@@ -163,12 +163,12 @@ static unsigned int init_lirc_timer(void)
 	if (count >= 1000 && timeelapsed > 0) {
 		if (default_timer == 0) {
 			/* autodetect timer */
-			newtimer = (1000000*count)/timeelapsed;
+			newtimer = (1000000 * count) / timeelapsed;
 			pr_info("%u Hz timer detected\n", newtimer);
 			return newtimer;
 		}
-		newtimer = (1000000*count)/timeelapsed;
-		if (abs(newtimer - default_timer) > default_timer/10) {
+		newtimer = (1000000 * count) / timeelapsed;
+		if (abs(newtimer - default_timer) > default_timer / 10) {
 			/* bad timer */
 			pr_notice("bad timer: %u Hz\n", newtimer);
 			pr_notice("using default timer: %u Hz\n",
Signature · 1 line
2.7.4
#8 lore raw

PATCH 5/6 staging: media: lirc: Mention data type along with 'unsigned'

In reply to Namrata A Shettar

Mention the data type along with the variable to resolve checkpatch issue.

---
 drivers/staging/media/lirc/lirc_sasem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/lirc/lirc_sasem.c +2 -2
index b080fde..9eb1eec 100644
@@ -73,7 +73,7 @@ static void usb_tx_callback(struct urb *urb);
 
 /* VFD file_operations function prototypes */
 static int vfd_open(struct inode *inode, struct file *file);
-static long vfd_ioctl(struct file *file, unsigned cmd, unsigned long arg);
+static long vfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
 static int vfd_close(struct inode *inode, struct file *file);
 static ssize_t vfd_write(struct file *file, const char __user *buf,
 				size_t n_bytes, loff_t *pos);
@@ -243,7 +243,7 @@ exit:
  * Called when the VFD device (e.g. /dev/usb/lcd)
  * is closed by the application.
  */
-static long vfd_ioctl(struct file *file, unsigned cmd, unsigned long arg)
+static long vfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
 	struct sasem_context *context;
 
Signature · 1 line
2.7.4
#9 lore raw

Re: [Outreachy kernel] [PATCH 5/6] staging: media: lirc: Mention data type along with 'unsigned'

Quoted 2 lines · Namrata A Shettar

Mention the data type along with the variable to resolve checkpatch issue.

The commit message is a bit obscure. "Convert unsigned to unsigned int..." would be more explicit.

julia

Quoted 38 lines
---
 drivers/staging/media/lirc/lirc_sasem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/lirc/lirc_sasem.c +2 -3
index b080fde..9eb1eec 100644
@@ -73,7 +73,7 @@ static void usb_tx_callback(struct urb *urb);
 
 /* VFD file_operations function prototypes */
 static int vfd_open(struct inode *inode, struct file *file);
-static long vfd_ioctl(struct file *file, unsigned cmd, unsigned long arg);
+static long vfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
 static int vfd_close(struct inode *inode, struct file *file);
 static ssize_t vfd_write(struct file *file, const char __user *buf,
 				size_t n_bytes, loff_t *pos);
@@ -243,7 +243,7 @@ exit:
  * Called when the VFD device (e.g. /dev/usb/lcd)
  * is closed by the application.
  */
-static long vfd_ioctl(struct file *file, unsigned cmd, unsigned long arg)
+static long vfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
 	struct sasem_context *context;
 
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/e1de5318efff31d1f7f18242ae534d5979aff12b.1474708456.git.namrataashettar%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#10 lore raw

PATCH 6/6 staging: media: lirc: Replace data type with pointer in sizeof()

In reply to Namrata A Shettar

Replace data tupe with pointer of same type in sizeof() to resolve checkpatch issue as they are of the same size.

---
 drivers/staging/media/lirc/lirc_sasem.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
drivers/staging/media/lirc/lirc_sasem.c +4 -14
index 9eb1eec..828efb3 100644
@@ -47,7 +47,6 @@
 #include <media/lirc.h>
 #include <media/lirc_dev.h>
 
-
 #define MOD_AUTHOR	"Oliver Stabel <[email protected]>, " \
 			"Tim Davies <[email protected]>"
 #define MOD_DESC	"USB Driver for Sasem Remote Controller V1.1"
@@ -86,7 +85,6 @@ static void ir_close(void *data);
 #define SASEM_DATA_BUF_SZ	32
 
 struct sasem_context {
-
 	struct usb_device *dev;
 	int vfd_isopen;			/* VFD port has been opened */
 	unsigned int vfd_contrast;	/* VFD contrast */
@@ -156,7 +154,6 @@ static int debug;
 
 
 /*** M O D U L E   C O D E ***/
-
 MODULE_AUTHOR(MOD_AUTHOR);
 MODULE_DESCRIPTION(MOD_DESC);
 MODULE_LICENSE("GPL");
@@ -186,7 +183,6 @@ static void deregister_from_lirc(struct sasem_context *context)
 	else
 		dev_info(&context->dev->dev,
 			 "Deregistered Sasem driver (minor:%d)\n", minor);
-
 }
 
 /**
@@ -297,7 +293,6 @@ static int vfd_close(struct inode *inode, struct file *file)
 		context->vfd_isopen = 0;
 		dev_info(&context->dev->dev, "VFD port closed\n");
 		if (!context->dev_present && !context->ir_isopen) {
-
 			/* Device disconnected before close and IR port is
 			 * not open. If IR port is open, context will be
 			 * deleted by ir_close. */
@@ -548,8 +543,7 @@ static void ir_close(void *data)
 		deregister_from_lirc(context);
 
 		if (!context->vfd_isopen) {
-
-			mutex_unlock(&context->ctx_lock);
+                	mutex_unlock(&context->ctx_lock);
 			delete_context(context);
 			return;
 		}
@@ -633,7 +627,6 @@ static void usb_rx_callback(struct urb *urb)
 		return;
 
 	switch (urb->status) {
-
 	case -ENOENT:		/* usbcore unlink successful! */
 		return;
 
@@ -651,8 +644,6 @@ static void usb_rx_callback(struct urb *urb)
 	usb_submit_urb(context->rx_urb, GFP_ATOMIC);
 }
 
-
-
 /**
  * Callback function for USB core API: Probe
  */
@@ -709,7 +700,6 @@ static int sasem_probe(struct usb_interface *interface,
 
 		} else if (!vfd_ep_found &&
 			usb_endpoint_is_int_out(ep)) {
-
 			tx_endpoint = ep;
 			vfd_ep_found = 1;
 			if (debug)
@@ -735,17 +725,17 @@ static int sasem_probe(struct usb_interface *interface,
 	/* Allocate memory */
 	alloc_status = 0;
 
-	context = kzalloc(sizeof(struct sasem_context), GFP_KERNEL);
+	context = kzalloc(sizeof(*context), GFP_KERNEL);
 	if (!context) {
 		alloc_status = 1;
 		goto alloc_status_switch;
 	}
-	driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
+	driver = kzalloc(sizeof(*driver), GFP_KERNEL);
 	if (!driver) {
 		alloc_status = 2;
 		goto alloc_status_switch;
 	}
-	rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
+	rbuf = kmalloc(sizeof(*rbuf), GFP_KERNEL);
 	if (!rbuf) {
 		alloc_status = 3;
 		goto alloc_status_switch;
Signature · 1 line
2.7.4
#11 lore raw

Re: [Outreachy kernel] [PATCH 6/6] staging: media: lirc: Replace data type with pointer in sizeof()

Quoted 2 lines · Namrata A Shettar

Replace data tupe with pointer of same type in sizeof() to resolve checkpatch issue as they are of the same size.

There are lots of removed blank lines in this patch that have nothing to do with the log message.

julia

Quoted 115 lines
---
 drivers/staging/media/lirc/lirc_sasem.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
drivers/staging/media/lirc/lirc_sasem.c +4 -15
index 9eb1eec..828efb3 100644
@@ -47,7 +47,6 @@
 #include <media/lirc.h>
 #include <media/lirc_dev.h>
 
-
 #define MOD_AUTHOR	"Oliver Stabel <[email protected]>, " \
 			"Tim Davies <[email protected]>"
 #define MOD_DESC	"USB Driver for Sasem Remote Controller V1.1"
@@ -86,7 +85,6 @@ static void ir_close(void *data);
 #define SASEM_DATA_BUF_SZ	32
 
 struct sasem_context {
-
 	struct usb_device *dev;
 	int vfd_isopen;			/* VFD port has been opened */
 	unsigned int vfd_contrast;	/* VFD contrast */
@@ -156,7 +154,6 @@ static int debug;
 
 
 /*** M O D U L E   C O D E ***/
-
 MODULE_AUTHOR(MOD_AUTHOR);
 MODULE_DESCRIPTION(MOD_DESC);
 MODULE_LICENSE("GPL");
@@ -186,7 +183,6 @@ static void deregister_from_lirc(struct sasem_context *context)
 	else
 		dev_info(&context->dev->dev,
 			 "Deregistered Sasem driver (minor:%d)\n", minor);
-
 }
 
 /**
@@ -297,7 +293,6 @@ static int vfd_close(struct inode *inode, struct file *file)
 		context->vfd_isopen = 0;
 		dev_info(&context->dev->dev, "VFD port closed\n");
 		if (!context->dev_present && !context->ir_isopen) {
-
 			/* Device disconnected before close and IR port is
 			 * not open. If IR port is open, context will be
 			 * deleted by ir_close. */
@@ -548,8 +543,7 @@ static void ir_close(void *data)
 		deregister_from_lirc(context);
 
 		if (!context->vfd_isopen) {
-
-			mutex_unlock(&context->ctx_lock);
+                	mutex_unlock(&context->ctx_lock);
 			delete_context(context);
 			return;
 		}
@@ -633,7 +627,6 @@ static void usb_rx_callback(struct urb *urb)
 		return;
 
 	switch (urb->status) {
-
 	case -ENOENT:		/* usbcore unlink successful! */
 		return;
 
@@ -651,8 +644,6 @@ static void usb_rx_callback(struct urb *urb)
 	usb_submit_urb(context->rx_urb, GFP_ATOMIC);
 }
 
-
-
 /**
  * Callback function for USB core API: Probe
  */
@@ -709,7 +700,6 @@ static int sasem_probe(struct usb_interface *interface,
 
 		} else if (!vfd_ep_found &&
 			usb_endpoint_is_int_out(ep)) {
-
 			tx_endpoint = ep;
 			vfd_ep_found = 1;
 			if (debug)
@@ -735,17 +725,17 @@ static int sasem_probe(struct usb_interface *interface,
 	/* Allocate memory */
 	alloc_status = 0;
 
-	context = kzalloc(sizeof(struct sasem_context), GFP_KERNEL);
+	context = kzalloc(sizeof(*context), GFP_KERNEL);
 	if (!context) {
 		alloc_status = 1;
 		goto alloc_status_switch;
 	}
-	driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
+	driver = kzalloc(sizeof(*driver), GFP_KERNEL);
 	if (!driver) {
 		alloc_status = 2;
 		goto alloc_status_switch;
 	}
-	rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
+	rbuf = kmalloc(sizeof(*rbuf), GFP_KERNEL);
 	if (!rbuf) {
 		alloc_status = 3;
 		goto alloc_status_switch;
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/c8caeedace5534475eeadfa5286256e361761edb.1474708456.git.namrataashettar%40gmail.com.
For more options, visit https://groups.google.com/d/optout.