public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: cx25821: fix coding style issues
@ 2011-08-01  9:33 Leonid V. Fedorenchik
  2011-08-01 16:14 ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Leonid V. Fedorenchik @ 2011-08-01  9:33 UTC (permalink / raw)
  To: gregkh
  Cc: mchehab, Palash.Bandyopadhyay, ruslan, Revent82, joe, arnd,
	linux-kernel, devel, Leonid V. Fedorenchik

Fix too long lines in cx25821-audio.h and cx25821-core.c
Fix wrong brace placement it cx25821-cards.c, cx25821-core.c,
and cx25821-i2c.c
Use DEFINE_PCI_DEVICE_TABLE for cx25821_pci_tbl.
Move EXPORT_SYMBOL(cx25821_set_gpiopin_direction) to the right place.
Delete file cx25821-gpio.h as it is not used.
Get rid of typedef in cx25821.h.

Signed-off-by: Leonid V. Fedorenchik <leonidsbox@gmail.com>
---
 drivers/staging/cx25821/cx25821-audio.h |    6 ++++--
 drivers/staging/cx25821/cx25821-cards.c |    2 +-
 drivers/staging/cx25821/cx25821-core.c  |   15 +++++++--------
 drivers/staging/cx25821/cx25821-gpio.c  |    1 +
 drivers/staging/cx25821/cx25821-gpio.h  |    2 --
 drivers/staging/cx25821/cx25821-i2c.c   |    6 +++---
 drivers/staging/cx25821/cx25821.h       |    8 +++++---
 7 files changed, 21 insertions(+), 19 deletions(-)
 delete mode 100644 drivers/staging/cx25821/cx25821-gpio.h

diff --git a/drivers/staging/cx25821/cx25821-audio.h b/drivers/staging/cx25821/cx25821-audio.h
index 2771725..a2098fb 100644
--- a/drivers/staging/cx25821/cx25821-audio.h
+++ b/drivers/staging/cx25821/cx25821-audio.h
@@ -36,13 +36,15 @@
  */
 #ifndef USE_RISC_NOOP
 #define MAX_BUFFER_PROGRAM_SIZE     \
-	(2*LINES_PER_BUFFER*RISC_WRITE_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE*4)
+	(2*LINES_PER_BUFFER*RISC_WRITE_INSTRUCTION_SIZE + \
+	RISC_WRITECR_INSTRUCTION_SIZE*4)
 #endif
 
 /* MAE 12 July 2005 Try to use NOOP RISC instruction instead */
 #ifdef USE_RISC_NOOP
 #define MAX_BUFFER_PROGRAM_SIZE     \
-	(2*LINES_PER_BUFFER*RISC_WRITE_INSTRUCTION_SIZE + RISC_NOOP_INSTRUCTION_SIZE*4)
+	(2*LINES_PER_BUFFER*RISC_WRITE_INSTRUCTION_SIZE + \
+	RISC_NOOP_INSTRUCTION_SIZE*4)
 #endif
 
 /* Sizes of various instructions in bytes.  Used when adding instructions. */
diff --git a/drivers/staging/cx25821/cx25821-cards.c b/drivers/staging/cx25821/cx25821-cards.c
index 94e8d68..9f7febd 100644
--- a/drivers/staging/cx25821/cx25821-cards.c
+++ b/drivers/staging/cx25821/cx25821-cards.c
@@ -57,7 +57,7 @@ struct cx25821_subid cx25821_subids[] = {
 	 .subvendor = 0x14f1,
 	 .subdevice = 0x0920,
 	 .card = CX25821_BOARD,
-	 },
+	},
 };
 
 void cx25821_card_setup(struct cx25821_dev *dev)
diff --git a/drivers/staging/cx25821/cx25821-core.c b/drivers/staging/cx25821/cx25821-core.c
index 523ac5e..3bf9239 100644
--- a/drivers/staging/cx25821/cx25821-core.c
+++ b/drivers/staging/cx25821/cx25821-core.c
@@ -972,8 +972,8 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
 	dev->lmmio = ioremap(dev->base_io_addr, pci_resource_len(dev->pci, 0));
 
 	if (!dev->lmmio) {
-		CX25821_ERR
-		    ("ioremap failed, maybe increasing __VMALLOC_RESERVE in page.h\n");
+		CX25821_ERR("ioremap failed, maybe increasing __VMALLOC_RESERVE"
+								" in page.h\n");
 		cx25821_iounmap(dev);
 		return -ENOMEM;
 	}
@@ -1011,8 +1011,8 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
 	if (video_register_device
 	    (dev->ioctl_dev, VFL_TYPE_GRABBER, VIDEO_IOCTL_CH) < 0) {
 		cx25821_videoioctl_unregister(dev);
-		pr_err("%s(): Failed to register video adapter for IOCTL, so unregistering videoioctl device\n",
-		       __func__);
+		pr_err("%s(): Failed to register video adapter for IOCTL, so "
+				"unregistering videoioctl device\n", __func__);
 	}
 
 	cx25821_dev_checkrevision(dev);
@@ -1473,17 +1473,17 @@ static void __devexit cx25821_finidev(struct pci_dev *pci_dev)
 	kfree(dev);
 }
 
-static struct pci_device_id cx25821_pci_tbl[] = {
+static DEFINE_PCI_DEVICE_TABLE(cx25821_pci_tbl) __used = {
 	{
 	 /* CX25821 Athena */
 	 .vendor = 0x14f1,
 	 .device = 0x8210,
 	 .subvendor = 0x14f1,
 	 .subdevice = 0x0920,
-	 },
+	},
 	{
 	 /* --- end of list --- */
-	 }
+	}
 };
 
 MODULE_DEVICE_TABLE(pci, cx25821_pci_tbl);
@@ -1512,7 +1512,6 @@ static void __exit cx25821_fini(void)
 	pci_unregister_driver(&cx25821_pci_driver);
 }
 
-EXPORT_SYMBOL(cx25821_set_gpiopin_direction);
 
 module_init(cx25821_init);
 module_exit(cx25821_fini);
diff --git a/drivers/staging/cx25821/cx25821-gpio.c b/drivers/staging/cx25821/cx25821-gpio.c
index 2f154b3..29e43b0 100644
--- a/drivers/staging/cx25821/cx25821-gpio.c
+++ b/drivers/staging/cx25821/cx25821-gpio.c
@@ -50,6 +50,7 @@ void cx25821_set_gpiopin_direction(struct cx25821_dev *dev,
 
 	cx_write(gpio_oe_reg, value);
 }
+EXPORT_SYMBOL(cx25821_set_gpiopin_direction);
 
 static void cx25821_set_gpiopin_logicvalue(struct cx25821_dev *dev,
 					   int pin_number, int pin_logic_value)
diff --git a/drivers/staging/cx25821/cx25821-gpio.h b/drivers/staging/cx25821/cx25821-gpio.h
deleted file mode 100644
index ca07644..0000000
--- a/drivers/staging/cx25821/cx25821-gpio.h
+++ /dev/null
@@ -1,2 +0,0 @@
-
-void cx25821_gpio_init(struct athena_dev *dev);
diff --git a/drivers/staging/cx25821/cx25821-i2c.c b/drivers/staging/cx25821/cx25821-i2c.c
index 130dfeb..ea5a878 100644
--- a/drivers/staging/cx25821/cx25821-i2c.c
+++ b/drivers/staging/cx25821/cx25821-i2c.c
@@ -374,12 +374,12 @@ int cx25821_i2c_read(struct cx25821_i2c *bus, u16 reg_addr, int *value)
 		 .flags = 0,
 		 .len = 2,
 		 .buf = addr,
-		 }, {
+		}, {
 		     .addr = client->addr,
 		     .flags = I2C_M_RD,
 		     .len = 4,
 		     .buf = buf,
-		     }
+		}
 	};
 
 	addr[0] = (reg_addr >> 8);
@@ -407,7 +407,7 @@ int cx25821_i2c_write(struct cx25821_i2c *bus, u16 reg_addr, int value)
 		 .flags = 0,
 		 .len = 6,
 		 .buf = buf,
-		 }
+		}
 	};
 
 	buf[0] = reg_addr >> 8;
diff --git a/drivers/staging/cx25821/cx25821.h b/drivers/staging/cx25821/cx25821.h
index 6230243..a282592 100644
--- a/drivers/staging/cx25821/cx25821.h
+++ b/drivers/staging/cx25821/cx25821.h
@@ -179,15 +179,17 @@ struct cx25821_input {
 	u32 gpio0, gpio1, gpio2, gpio3;
 };
 
-typedef enum {
+enum port {
 	CX25821_UNDEFINED = 0,
 	CX25821_RAW,
 	CX25821_264
-} port_t;
+};
 
 struct cx25821_board {
 	char *name;
-	port_t porta, portb, portc;
+	enum port porta;
+	enum port portb;
+	enum port portc;
 	unsigned int tuner_type;
 	unsigned int radio_type;
 	unsigned char tuner_addr;
-- 
1.7.0.4


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

* Re: [PATCH] Staging: cx25821: fix coding style issues
  2011-08-01  9:33 [PATCH] Staging: cx25821: fix coding style issues Leonid V. Fedorenchik
@ 2011-08-01 16:14 ` Joe Perches
  2011-08-02  9:18   ` Leonid V. Fedorenchik
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2011-08-01 16:14 UTC (permalink / raw)
  To: Leonid V. Fedorenchik
  Cc: gregkh, devel, mchehab, arnd, linux-kernel, Palash.Bandyopadhyay,
	ruslan, Revent82

On Mon, 2011-08-01 at 17:33 +0800, Leonid V. Fedorenchik wrote:
> Fix too long lines in cx25821-audio.h and cx25821-core.c
[]
> diff --git a/drivers/staging/cx25821/cx25821-core.c b/drivers/staging/cx25821/cx25821-core.c
[]
> @@ -972,8 +972,8 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
>  	dev->lmmio = ioremap(dev->base_io_addr, pci_resource_len(dev->pci, 0));
>  
>  	if (!dev->lmmio) {
> -		CX25821_ERR
> -		    ("ioremap failed, maybe increasing __VMALLOC_RESERVE in page.h\n");
> +		CX25821_ERR("ioremap failed, maybe increasing __VMALLOC_RESERVE"
> +								" in page.h\n");

Please do not split formats.

>  		cx25821_iounmap(dev);
>  		return -ENOMEM;
>  	}
> @@ -1011,8 +1011,8 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
>  	if (video_register_device
>  	    (dev->ioctl_dev, VFL_TYPE_GRABBER, VIDEO_IOCTL_CH) < 0) {
>  		cx25821_videoioctl_unregister(dev);
> -		pr_err("%s(): Failed to register video adapter for IOCTL, so unregistering videoioctl device\n",
> -		       __func__);
> +		pr_err("%s(): Failed to register video adapter for IOCTL, so "
> +				"unregistering videoioctl device\n", __func__);

This was better before the change.

> -static struct pci_device_id cx25821_pci_tbl[] = {
> +static DEFINE_PCI_DEVICE_TABLE(cx25821_pci_tbl) __used = {

__used?  Hard to believe that's necessary here.



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

* Re: [PATCH] Staging: cx25821: fix coding style issues
  2011-08-01 16:14 ` Joe Perches
@ 2011-08-02  9:18   ` Leonid V. Fedorenchik
  2011-08-02 11:42     ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 4+ messages in thread
From: Leonid V. Fedorenchik @ 2011-08-02  9:18 UTC (permalink / raw)
  To: Joe Perches
  Cc: gregkh, devel, mchehab, arnd, linux-kernel, Palash.Bandyopadhyay,
	ruslan, Revent82

Thanks for the review. I sent v2. I have a question, however...

On Mon, 01 Aug 2011 09:14:22 -0700
Joe Perches <joe@perches.com> wrote:

> On Mon, 2011-08-01 at 17:33 +0800, Leonid V. Fedorenchik wrote:
> > Fix too long lines in cx25821-audio.h and cx25821-core.c
> []
> > diff --git a/drivers/staging/cx25821/cx25821-core.c b/drivers/staging/cx25821/cx25821-core.c
> []
> > @@ -972,8 +972,8 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
> >  	dev->lmmio = ioremap(dev->base_io_addr, pci_resource_len(dev->pci, 0));
> >  
> >  	if (!dev->lmmio) {
> > -		CX25821_ERR
> > -		    ("ioremap failed, maybe increasing __VMALLOC_RESERVE in page.h\n");
> > +		CX25821_ERR("ioremap failed, maybe increasing __VMALLOC_RESERVE"
> > +								" in page.h\n");
> 
> Please do not split formats.

What is the reason to not split formats?
I can see that in Documentation/CodingStyle in Chapter 2 it is OK to split
formats if it is not making readability worse.
So, is it for the sake of readability or is it new coding style rule for the
kernel that is not in documentation yet or something else or am I misunderstood
something?

Leonid V. Fedorenchik

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

* Re: [PATCH] Staging: cx25821: fix coding style issues
  2011-08-02  9:18   ` Leonid V. Fedorenchik
@ 2011-08-02 11:42     ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2011-08-02 11:42 UTC (permalink / raw)
  To: Leonid V. Fedorenchik
  Cc: Joe Perches, gregkh, devel, arnd, linux-kernel,
	Palash.Bandyopadhyay, ruslan, Revent82

Em 02-08-2011 06:18, Leonid V. Fedorenchik escreveu:
> Thanks for the review. I sent v2. I have a question, however...
> 
> On Mon, 01 Aug 2011 09:14:22 -0700
> Joe Perches <joe@perches.com> wrote:
> 
>> On Mon, 2011-08-01 at 17:33 +0800, Leonid V. Fedorenchik wrote:
>>> Fix too long lines in cx25821-audio.h and cx25821-core.c
>> []
>>> diff --git a/drivers/staging/cx25821/cx25821-core.c b/drivers/staging/cx25821/cx25821-core.c
>> []
>>> @@ -972,8 +972,8 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
>>>  	dev->lmmio = ioremap(dev->base_io_addr, pci_resource_len(dev->pci, 0));
>>>  
>>>  	if (!dev->lmmio) {
>>> -		CX25821_ERR
>>> -		    ("ioremap failed, maybe increasing __VMALLOC_RESERVE in page.h\n");
>>> +		CX25821_ERR("ioremap failed, maybe increasing __VMALLOC_RESERVE"
>>> +								" in page.h\n");
>>
>> Please do not split formats.
> 
> What is the reason to not split formats?
> I can see that in Documentation/CodingStyle in Chapter 2 it is OK to split
> formats if it is not making readability worse.
> So, is it for the sake of readability or is it new coding style rule for the
> kernel that is not in documentation yet or something else or am I misunderstood
> something?

Breaking long printk lines break things like:
	git grep "__VMALLOC_RESERVE in page.h"


Cheers,
Mauro

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

end of thread, other threads:[~2011-08-02 11:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-01  9:33 [PATCH] Staging: cx25821: fix coding style issues Leonid V. Fedorenchik
2011-08-01 16:14 ` Joe Perches
2011-08-02  9:18   ` Leonid V. Fedorenchik
2011-08-02 11:42     ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox