[PATCH] mw09_style_fixes.patch

Andy Green andy at openmoko.com
Mon May 26 20:26:12 CEST 2008


Signed-off-by: Andy Green <andy at openmoko.com>
---

 arch/arm/mach-s3c2440/mach-gta02.c     |    2 -
 arch/arm/plat-s3c24xx/neo1973_pm_gsm.c |   31 ++++++------
 drivers/serial/s3c2410.c               |   86 +++++++++++++++++++-------------
 include/linux/neospy.h                 |    6 +-
 4 files changed, 72 insertions(+), 53 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index 62a2f33..9744ac2 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -1379,7 +1379,7 @@ extern int gta_gsm_interrupts;
 static irqreturn_t gta02_modem_irq(int irq, void *param)
 {
 	printk(KERN_DEBUG "GSM wakeup interrupt.\n");
-        gta_gsm_interrupts++;
+	gta_gsm_interrupts++;
 	nspy_add(NSPY_TYPE_SPECIAL, '*', jiffies);
 	return IRQ_HANDLED;
 }
diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
index 68ba8b8..3d086bc 100644
--- a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
+++ b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
@@ -39,21 +39,21 @@ extern void s3c24xx_fake_rx_interrupt(int l);
 static struct work_struct gsmwork;
 
 /* flag set if we flow-controlled the GSM in our suspend routine */
-int gsm_auto_flowcontrolled = 0;
+int gsm_auto_flowcontrolled;
 
 /* msecs to delay the auto-unlock after resume to minimize overruns */
 int gsm_autounlock_delay = 750;
 
 struct neospy_logdata neospy;
 EXPORT_SYMBOL(neospy);
-int nspy_showctrl = 0;
+int nspy_showctrl;
 int nspy_linewrap = 72;
 int nspy_jifdelta = 100;
 
-int gta01_gsm_enabled = 0;
+int gta01_gsm_enabled;
 EXPORT_SYMBOL(gta01_gsm_enabled);
 
-int gta_gsm_interrupts = 0;
+int gta_gsm_interrupts;
 EXPORT_SYMBOL(gta_gsm_interrupts);
 
 struct gta01pm_priv {
@@ -87,9 +87,11 @@ static ssize_t gsm_read(struct device *dev, struct device_attribute *attr,
 		if (s3c2410_gpio_getpin(GTA01_GPIO_MODEM_ON))
 			goto out_1;
 	} else if (!strcmp(attr->attr.name, "reset")) {
-		if (machine_is_neo1973_gta01() && s3c2410_gpio_getpin(GTA01_GPIO_MODEM_RST))
+		if (machine_is_neo1973_gta01() &&
+		    s3c2410_gpio_getpin(GTA01_GPIO_MODEM_RST))
 			goto out_1;
-		else if (machine_is_neo1973_gta02() && s3c2410_gpio_getpin(GTA02_GPIO_MODEM_RST))
+		else if (machine_is_neo1973_gta02() &&
+			 s3c2410_gpio_getpin(GTA02_GPIO_MODEM_RST))
 			goto out_1;
 	} else if (!strcmp(attr->attr.name, "download")) {
 		if (machine_is_neo1973_gta01()) {
@@ -140,7 +142,7 @@ static ssize_t gsm_read(struct device *dev, struct device_attribute *attr,
 			ch = neospy.buf[neospy.bot] & NSPY_DATAMASK;
 			ty = neospy.buf[neospy.bot] & NSPY_TYPEMASK;
 			ji = neospy.buf[neospy.bot] >> NSPY_JIFSHIFT;
-			
+
 			/* (And, yes, the above should be done with a mutex.
 			 * We'll take the risk, and just be careful about
 			 * our conditionals, and make sure that there's an
@@ -148,11 +150,11 @@ static ssize_t gsm_read(struct device *dev, struct device_attribute *attr,
 			 */
 
 			/* Determine if we need a new line */
-			if (ty != oty)				/* type change */
+			if (ty != oty)			/* type change */
 				newline = 1;
-			if ((bi - li) > nspy_linewrap)		/* line length */
+			if ((bi - li) > nspy_linewrap)	/* line length */
 				newline = 1;
-			if ((ji - oji) > nspy_jifdelta)		/* time delta */
+			if ((ji - oji) > nspy_jifdelta)	/* time delta */
 				newline = 1;
 
 			/* Start a new line if necessary */
@@ -170,7 +172,7 @@ static ssize_t gsm_read(struct device *dev, struct device_attribute *attr,
 
 				/* Print the introduction and event type */
 				bi += snprintf(&buf[bi], 24, "%4d.%03d: ",
-					       ji/HZ, (ji%HZ)*(1000/HZ));
+						     ji/HZ, (ji%HZ)*(1000/HZ));
 				switch (ty) {
 				case NSPY_TYPE_NONE:
 					buf[bi++] = '-';
@@ -219,7 +221,7 @@ static ssize_t gsm_read(struct device *dev, struct device_attribute *attr,
 			if ((ch >= ' ') && (ch <= '~'))
 				buf[bi++] = ch;
 			else {
-				if (! nspy_showctrl)
+				if (!nspy_showctrl)
 					buf[bi++] = '.';
 				else {
 					switch (ch) {
@@ -240,7 +242,8 @@ static ssize_t gsm_read(struct device *dev, struct device_attribute *attr,
 						buf[bi++] = '\\';
 						break;
 					default:
-						bi += snprintf(&buf[bi], 5, "\\%03o", ch);
+						bi += snprintf(&buf[bi], 5,
+								  "\\%03o", ch);
 					}
 				}
 			}
@@ -498,7 +501,7 @@ static int gta01_gsm_resume(struct platform_device *pdev)
 
 	/* We must defer the auto flowcontrol because we resume before
 	 * the serial driver */
-	if (! schedule_work(&gsmwork))
+	if (!schedule_work(&gsmwork))
 		dev_err(&pdev->dev,
 			"Unable to schedule GSM wakeup work\n");
 
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index 462d09c..3315fca 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -160,7 +160,8 @@ s3c24xx_serial_dbg(const char *fmt, ...)
 /* conversion functions */
 
 #define s3c24xx_dev_to_port(__dev) (struct uart_port *)dev_get_drvdata(__dev)
-#define s3c24xx_dev_to_cfg(__dev) (struct s3c2410_uartcfg *)((__dev)->platform_data)
+#define s3c24xx_dev_to_cfg(__dev) \
+			      (struct s3c2410_uartcfg *)((__dev)->platform_data)
 
 /* we can support 3 uarts, but not always use them */
 
@@ -286,12 +287,14 @@ static void s3c24xx_serial_enable_ms(struct uart_port *port)
 {
 }
 
-static inline struct s3c24xx_uart_info *s3c24xx_port_to_info(struct uart_port *port)
+static inline struct s3c24xx_uart_info *s3c24xx_port_to_info(struct uart_port
+									  *port)
 {
 	return to_ourport(port)->info;
 }
 
-static inline struct s3c2410_uartcfg *s3c24xx_port_to_cfg(struct uart_port *port)
+static inline struct s3c2410_uartcfg *s3c24xx_port_to_cfg(struct uart_port
+									  *port)
 {
 	if (port->dev == NULL)
 		return NULL;
@@ -398,14 +401,16 @@ s3c24xx_serial_rx_chars(int irq, void *dev_id)
 				flag = TTY_BREAK;
 			else if (uerstat & S3C2410_UERSTAT_PARITY)
 				flag = TTY_PARITY;
-			else if (uerstat & ( S3C2410_UERSTAT_FRAME | S3C2410_UERSTAT_OVERRUN))
+			else if (uerstat & (S3C2410_UERSTAT_FRAME |
+					    S3C2410_UERSTAT_OVERRUN))
 				flag = TTY_FRAME;
 		}
 
 		if (uart_handle_sysrq_char(port, ch))
 			goto ignore_char;
 
-		uart_insert_char(port, uerstat, S3C2410_UERSTAT_OVERRUN, ch, flag);
+		uart_insert_char(port, uerstat, S3C2410_UERSTAT_OVERRUN, ch,
+									  flag);
 		if (cfg->hwport == 0) {
 			if (afc_is_enabled)
 				nspy_add(NSPY_TYPE_CIN, ch, jiffies);
@@ -422,7 +427,7 @@ s3c24xx_serial_rx_chars(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-struct s3c24xx_uart_port *gta01_devptr = NULL;
+struct s3c24xx_uart_port *gta01_devptr;
 #define FAKE_BSIZE	64
 void s3c24xx_fake_rx_interrupt(int l)
 {
@@ -437,19 +442,19 @@ void s3c24xx_fake_rx_interrupt(int l)
 	int i, top, lctr;
 
 	ourport = gta01_devptr;
-	if (! ourport)
+	if (!ourport)
 		return;
 
 	port = &ourport->port;
-	if (! port)
+	if (!port)
 		return;
 
 	tty = port->info->tty;
-	if (! tty)
+	if (!tty)
 		return;
 
 	cfg = s3c24xx_port_to_cfg(port);
-	if (! cfg)
+	if (!cfg)
 		return;
 
 	disable_irq(RX_IRQ(port));
@@ -463,7 +468,8 @@ void s3c24xx_fake_rx_interrupt(int l)
 
 	printk(KERN_ERR "%s @ entry: ulcon=0x%08x, ucon=0x%08x, ufcon=0x%08x\n",
 	       __FUNCTION__, ulcon, ucon, ufcon);
-	printk(KERN_ERR "%s @ entry: umcon=0x%08x, ufstat=0x%08x, umstat=0x%08x\n",
+	printk(KERN_ERR
+	       "%s @ entry: umcon=0x%08x, ufstat=0x%08x, umstat=0x%08x\n",
 	       __FUNCTION__, umcon, ufstat, umstat);
 
 	n = s3c24xx_serial_rx_fifocnt(ourport, ufstat);
@@ -481,7 +487,7 @@ void s3c24xx_fake_rx_interrupt(int l)
 	top = 0;
 	d = FAKE_BSIZE;
 	lctr = 0;
-	if (! (umcon & S3C2410_UMCOM_AFC)) {
+	if (!(umcon & S3C2410_UMCOM_AFC)) {
 		wr_regl(port, S3C2410_UMCON, (umcon | S3C2410_UMCOM_AFC));
 		printk(KERN_ERR "%s @ entry: set AFC.\n", __FUNCTION__);
 	}
@@ -491,13 +497,10 @@ void s3c24xx_fake_rx_interrupt(int l)
 		u = rd_regl(port, S3C2410_UFSTAT) & 0x10f;
 		if (u == 0) {
 			c = l;
-			while ((c-- > 0) && (u == 0)) {
+			while ((c-- > 0) && (u == 0))
 				u = rd_regl(port, S3C2410_UFSTAT) & 0x10f;
-			}
 
-			if (u == 0) {
-				/* printk(KERN_ERR "%s @ loop: no characters left...\n", __FUNCTION__); */
-			} else {
+			if (u) {
 				i = l - c;
 				if (i > lctr)
 					lctr = i;
@@ -508,7 +511,6 @@ void s3c24xx_fake_rx_interrupt(int l)
 			n = 16;
 		else
 			n = u & 0xf;
-		/* printk(KERN_ERR "RX loop: %d chars await.\n", n); */
 
 		while ((top < FAKE_BSIZE) && (n-- > 0)) {
 			ubuf[top] = rd_regl(port, S3C2410_UERSTAT);
@@ -529,7 +531,8 @@ void s3c24xx_fake_rx_interrupt(int l)
 			if (uerstat & S3C2410_UERSTAT_OVERRUN)
 				flag = TTY_FRAME;
 		}
-		uart_insert_char(port, uerstat, S3C2410_UERSTAT_OVERRUN, ch, flag);
+		uart_insert_char(port, uerstat, S3C2410_UERSTAT_OVERRUN, ch,
+									  flag);
 		if (umcon & S3C2410_UMCOM_AFC)
 			nspy_add(NSPY_TYPE_CIN, ch, jiffies);
 		else
@@ -539,7 +542,8 @@ void s3c24xx_fake_rx_interrupt(int l)
 
 	nspy_add(NSPY_TYPE_SPECIAL, ']', jiffies);
 	enable_irq(RX_IRQ(port));
-	printk(KERN_ERR "%s @ exit: max loop counter was %d...\n", __FUNCTION__, lctr);
+	printk(KERN_ERR "%s @ exit: max loop counter was %d...\n", __FUNCTION__,
+									  lctr);
 }
 EXPORT_SYMBOL(s3c24xx_fake_rx_interrupt);
 
@@ -577,7 +581,8 @@ static irqreturn_t s3c24xx_serial_tx_chars(int irq, void *id)
 
 		wr_regb(port, S3C2410_UTXH, xmit->buf[xmit->tail]);
 		if (cfg->hwport == 0)
-			nspy_add(NSPY_TYPE_COUT, xmit->buf[xmit->tail], jiffies);
+			nspy_add(NSPY_TYPE_COUT, xmit->buf[xmit->tail],
+								       jiffies);
 		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
 		port->icount.tx++;
 	}
@@ -621,9 +626,9 @@ static unsigned int s3c24xx_serial_get_mctrl(struct uart_port *port)
 }
 
 /* set during suspend/resume to ensure only user-space changes GSM mctrl */
-static int doing_serial_suspend_resume = 0;
+static int doing_serial_suspend_resume;
 /* flag to ensure that we only re-assert if, in fact, we did the de-assert */
-static int gsm_mctrl_flowcontrolled = 0;
+static int gsm_mctrl_flowcontrolled;
 
 static void s3c24xx_serial_set_mctrl(struct uart_port *port, unsigned int mctrl)
 {
@@ -643,17 +648,21 @@ static void s3c24xx_serial_set_mctrl(struct uart_port *port, unsigned int mctrl)
 		return;
 
 	if (mctrl & TIOCM_RTS) {
-		/* Return RTS to the UART - but only if we de-asserted it originally */
+		/* Return RTS to the UART - but only if
+		 * we de-asserted it originally
+		 */
 		if (gsm_mctrl_flowcontrolled) {
 			nspy_add(NSPY_TYPE_SPECIAL, '+', jiffies);
 			s3c2410_gpio_cfgpin(S3C2410_GPH1, S3C2410_GPH1_nRTS0);
 			gsm_mctrl_flowcontrolled = 0;
 		}
 	} else {
-		/* Hold RTS off by turning it into a GPIO, if not already done */
-		if (s3c2410_gpio_getcfg(S3C2410_GPH1) == S3C2410_GPIO_OUTPUT) {
+		/* Hold RTS off by turning it into a GPIO,
+		 * if not already done
+		 */
+		if (s3c2410_gpio_getcfg(S3C2410_GPH1) == S3C2410_GPIO_OUTPUT)
 			gsm_mctrl_flowcontrolled = 0;
-		} else {
+		else {
 			gta_gsm_interrupts = 0;
 			s3c2410_gpio_setpin(S3C2410_GPH1, 1);
 			s3c2410_gpio_cfgpin(S3C2410_GPH1, S3C2410_GPH1_OUTP);
@@ -1035,7 +1044,8 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
 	 */
 	port->read_status_mask = S3C2410_UERSTAT_OVERRUN;
 	if (termios->c_iflag & INPCK)
-		port->read_status_mask |= S3C2410_UERSTAT_FRAME | S3C2410_UERSTAT_PARITY;
+		port->read_status_mask |= S3C2410_UERSTAT_FRAME |
+					  S3C2410_UERSTAT_PARITY;
 
 	/*
 	 * Which character status flags should we ignore?
@@ -1149,7 +1159,8 @@ static struct uart_driver s3c24xx_uart_drv = {
 static struct s3c24xx_uart_port s3c24xx_serial_ports[NR_PORTS] = {
 	[0] = {
 		.port = {
-			.lock		= __SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[0].port.lock),
+			.lock		= __SPIN_LOCK_UNLOCKED(
+					     s3c24xx_serial_ports[0].port.lock),
 			.iotype		= UPIO_MEM,
 			.irq		= IRQ_S3CUART_RX0,
 			.uartclk	= 0,
@@ -1161,7 +1172,8 @@ static struct s3c24xx_uart_port s3c24xx_serial_ports[NR_PORTS] = {
 	},
 	[1] = {
 		.port = {
-			.lock		= __SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[1].port.lock),
+			.lock		= __SPIN_LOCK_UNLOCKED(
+					     s3c24xx_serial_ports[1].port.lock),
 			.iotype		= UPIO_MEM,
 			.irq		= IRQ_S3CUART_RX1,
 			.uartclk	= 0,
@@ -1175,7 +1187,8 @@ static struct s3c24xx_uart_port s3c24xx_serial_ports[NR_PORTS] = {
 
 	[2] = {
 		.port = {
-			.lock		= __SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[2].port.lock),
+			.lock		= __SPIN_LOCK_UNLOCKED(
+					     s3c24xx_serial_ports[2].port.lock),
 			.iotype		= UPIO_MEM,
 			.irq		= IRQ_S3CUART_RX2,
 			.uartclk	= 0,
@@ -1315,7 +1328,8 @@ static int s3c24xx_serial_remove(struct platform_device *dev)
 
 #ifdef CONFIG_PM
 
-static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t state)
+static int s3c24xx_serial_suspend(struct platform_device *dev,
+							     pm_message_t state)
 {
 	struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
 	struct s3c2410_uartcfg *cfg;
@@ -1355,11 +1369,11 @@ static int s3c24xx_serial_resume(struct platform_device *dev)
 {
 	struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
 	struct s3c24xx_uart_port *ourport = to_ourport(port);
- 	struct s3c2410_uartcfg *cfg;
+	struct s3c2410_uartcfg *cfg;
 	unsigned int umcon;
 
 	if (port) {
- 		cfg = s3c24xx_port_to_cfg(port);
+		cfg = s3c24xx_port_to_cfg(port);
 		if (cfg->hwport == 0) {
 			doing_serial_suspend_resume = 1;
 			nspy_add(NSPY_TYPE_RESUME, 'S', jiffies);
@@ -1383,7 +1397,9 @@ static int s3c24xx_serial_resume(struct platform_device *dev)
 			else
 				nspy_add(NSPY_TYPE_RESUME, 'j', jiffies);
 			nspy_add(NSPY_TYPE_RESUME, '}', jiffies);
-			/* stash away the port info for the fake RX IRQ routine */
+			/* stash away the port info
+			 * for the fake RX IRQ routine
+			 */
 			gta01_devptr = ourport;
 			doing_serial_suspend_resume = 0;
 		}
diff --git a/include/linux/neospy.h b/include/linux/neospy.h
index 845aad9..eb5add7 100644
--- a/include/linux/neospy.h
+++ b/include/linux/neospy.h
@@ -44,14 +44,14 @@ struct neospy_logdata {
  */
 
 #define nspy_init() \
-	do { neospy.enabled = neospy.bot = neospy.top = 0;} while(0)
+	do { neospy.enabled = neospy.bot = neospy.top = 0; } while (0)
 
 #define nspy_enable(i) \
-	do { neospy.enabled = i; } while(0)
+	do { neospy.enabled = i; } while (0)
 
 #define nspy_is_enabled()	(neospy.enabled)
 
-#define nspy_add(t,i,j)				\
+#define nspy_add(t, i, j)				\
 do { \
 	if (neospy.enabled) { \
 		if (++neospy.top >= NSPY_BUFN) \





More information about the openmoko-kernel mailing list