All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Staging: ft1000: fix some coding style issues
@ 2014-12-04  1:49 Kevin Pietsch
  2014-12-04  1:58 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Pietsch @ 2014-12-04  1:49 UTC (permalink / raw)
  To: Marek Belisko, Greg Kroah-Hartman, devel; +Cc: linux-kernel, Kevin Pietsch

Removed braces from two single line if-else statements

Signed-off-by: Kevin Pietsch <kevinpietsch@gmail.com>
---
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
index 44575c7..fadd47d 100644
--- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
@@ -176,11 +176,10 @@ u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index)
 	spin_lock_irqsave(&info->dpram_lock, flags);
 	ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset);
 	/* check if we want to read upper or lower 32-bit word */
-	if (Index) {
+	if (Index)
 		data = ft1000_read_reg(dev, FT1000_REG_MAG_DPDATAL);
-	} else {
+	else
 		data = ft1000_read_reg(dev, FT1000_REG_MAG_DPDATAH);
-	}
 	spin_unlock_irqrestore(&info->dpram_lock, flags);
 
 	return data;
@@ -208,11 +207,10 @@ static inline void ft1000_write_dpram_mag_16(struct net_device *dev,
 	/* Provide mutual exclusive access while reading ASIC registers. */
 	spin_lock_irqsave(&info->dpram_lock, flags);
 	ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset);
-	if (Index) {
+	if (Index)
 		ft1000_write_reg(dev, FT1000_REG_MAG_DPDATAL, value);
-	} else {
+	else
 		ft1000_write_reg(dev, FT1000_REG_MAG_DPDATAH, value);
-	}
 	spin_unlock_irqrestore(&info->dpram_lock, flags);
 }
 
-- 
2.1.0


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

* Re: [PATCH 1/1] Staging: ft1000: fix some coding style issues
  2014-12-04  1:49 [PATCH 1/1] Staging: ft1000: fix some coding style issues Kevin Pietsch
@ 2014-12-04  1:58 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2014-12-04  1:58 UTC (permalink / raw)
  To: Kevin Pietsch; +Cc: Marek Belisko, Greg Kroah-Hartman, devel, linux-kernel

On Wed, 2014-12-03 at 20:49 -0500, Kevin Pietsch wrote:
> Removed braces from two single line if-else statements

Another perhaps better option is to use ?: like:
---
 drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
index 0038a3a..8743516 100644
--- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
@@ -172,11 +172,8 @@ u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index)
 	spin_lock_irqsave(&info->dpram_lock, flags);
 	ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset);
 	/* check if we want to read upper or lower 32-bit word */
-	if (Index) {
-		data = ft1000_read_reg(dev, FT1000_REG_MAG_DPDATAL);
-	} else {
-		data = ft1000_read_reg(dev, FT1000_REG_MAG_DPDATAH);
-	}
+	data = ft1000_read_reg(dev, index ? FT1000_REG_MAG_DPDATAL
+					  : FT1000_REG_MAG_DPDATAH);
 	spin_unlock_irqrestore(&info->dpram_lock, flags);
 
 	return data;
@@ -204,11 +201,8 @@ static inline void ft1000_write_dpram_mag_16(struct net_device *dev,
 	/* Provide mutual exclusive access while reading ASIC registers. */
 	spin_lock_irqsave(&info->dpram_lock, flags);
 	ft1000_write_reg(dev, FT1000_REG_DPRAM_ADDR, offset);
-	if (Index) {
-		ft1000_write_reg(dev, FT1000_REG_MAG_DPDATAL, value);
-	} else {
-		ft1000_write_reg(dev, FT1000_REG_MAG_DPDATAH, value);
-	}
+	ft1000_write_reg(dev, index ? FT1000_REG_MAG_DPDATAL
+				    : FT1000_REG_MAG_DPDATAH, value);
 	spin_unlock_irqrestore(&info->dpram_lock, flags);
 }
 



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

end of thread, other threads:[~2014-12-04  1:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-04  1:49 [PATCH 1/1] Staging: ft1000: fix some coding style issues Kevin Pietsch
2014-12-04  1:58 ` Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.