Re: [PATCH] net/ethernet/sgi: Code cleanup

2017-10-19 Thread Joshua Kinard
On 10/19/2017 08:27, David Miller wrote:
> From: Joshua Kinard 
> Date: Tue, 17 Oct 2017 13:54:30 -0400
> 
>> From: Joshua Kinard 
>>
>> The below patch attempts to clean up the code for the in-tree driver
>> for IOC3 ethernet and serial console support, primarily used by SGI
>> MIPS platforms.  Notable changes include:
>>
>>   - Lots of whitespace cleanup
>>   - Using shorthand integer types (u16, u32, etc) where appropriate
> 
> These seem to be arbitrary, "unsigned int" is a fine value for a
> hash computation.

I can back those changes out if you'd like.  I was aiming more for consistency.
 There is one specific change that is required, where the IP protocol number is
being parsed into a signed char field when it should be unsigned char.  I can
send that in as its own patch if you'd like.


> You're also making many different kinds of changes in one patch
> which makes it very difficult to review.

This patch is more of a preparation patch, because I have additional pending
changes to move towards using the IOC3 "metadriver" (drivers/sn/ioc3.c) on the
supported MIPS/SGI systems.  That metadriver is only used by IA64 right now.
The changes in this patch were primarily to reduce the diff size of the
metadriver patch when I get time to get it cleaned up.

I can either try for a v2 of this patch to split it up, or hold off and make it
part of the metadriver patch.  I figured since that patch will need to go
through several subsystem reviewers, better to try sending this one in first.


> This driver is also for such ancient hardware, that the risk
> of potentially breaking the driver far outweighs the value of
> "cleaning up" the code.

I am familiar with this hardware, actually.  I have several SGI machines
powered on periodically that use this particular chip, and am familiar with its
quirks and frustrations.  Although it's been a while since I tested this
specific batch of changes by itself, the last time I did, the machine booted
fine.  With the metadriver patch applied on top, I know this driver works
well-enough.

-- 
Joshua Kinard
Gentoo/MIPS
ku...@gentoo.org
6144R/F5C6C943 2015-04-27
177C 1972 1FB8 F254 BAD0 3E72 5C63 F4E3 F5C6 C943

"The past tempts us, the present confuses us, the future frightens us.  And our
lives slip away, moment by moment, lost in that vast, terrible in-between."

--Emperor Turhan, Centauri Republic


Re: [PATCH] net/ethernet/sgi: Code cleanup

2017-10-19 Thread David Miller
From: Joshua Kinard 
Date: Tue, 17 Oct 2017 13:54:30 -0400

> From: Joshua Kinard 
> 
> The below patch attempts to clean up the code for the in-tree driver
> for IOC3 ethernet and serial console support, primarily used by SGI
> MIPS platforms.  Notable changes include:
> 
>   - Lots of whitespace cleanup
>   - Using shorthand integer types (u16, u32, etc) where appropriate

These seem to be arbitrary, "unsigned int" is a fine value for a
hash computation.

You're also making many different kinds of changes in one patch
which makes it very difficult to review.

This driver is also for such ancient hardware, that the risk
of potentially breaking the driver far outweighs the value of
"cleaning up" the code.


[PATCH] net/ethernet/sgi: Code cleanup

2017-10-17 Thread Joshua Kinard
From: Joshua Kinard 

The below patch attempts to clean up the code for the in-tree driver
for IOC3 ethernet and serial console support, primarily used by SGI
MIPS platforms.  Notable changes include:

  - Lots of whitespace cleanup
  - Using shorthand integer types (u16, u32, etc) where appropriate
  - Moving the function name to the next line after type declarations
  - Using the multiline comment syntax preferred by the networking
subsystem
  - Wrapping some long lines to ~80 chars
  - Spelling/grammar fixes in comments
  - Other minor cleanups

Cc: Ralf Baechle 
Cc: linux-m...@linux-mips.org
Cc: netdev@vger.kernel.org
Signed-off-by: Joshua Kinard 
---
 drivers/net/ethernet/sgi/ioc3-eth.c |  425 ++
 1 file changed, 240 insertions(+), 185 deletions(-)

diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c 
b/drivers/net/ethernet/sgi/ioc3-eth.c
index 9c0488e0f08e..ad014551923a 100644
--- a/drivers/net/ethernet/sgi/ioc3-eth.c
+++ b/drivers/net/ethernet/sgi/ioc3-eth.c
@@ -66,13 +66,13 @@
 #include 
 
 /*
- * 64 RX buffers.  This is tunable in the range of 16 <= x < 512.  The
- * value must be a power of two.
+ * 64 RX buffers.  This is tunable in the range of 16 <= x < 512.
+ * The value must be a power of two.
  */
 #define RX_BUFFS 64
 
-#define ETCSR_FD   ((17<midr_w)
 #define ioc3_w_midr_w(v)   do { ioc3->midr_w = cpu_to_be32(v); } while (0)
 
-static inline u32 mcr_pack(u32 pulse, u32 sample)
+static inline u32
+mcr_pack(u32 pulse, u32 sample)
 {
return (pulse << 10) | (sample << 2);
 }
 
-static int nic_wait(struct ioc3 *ioc3)
+static int
+nic_wait(struct ioc3 *ioc3)
 {
u32 mcr;
 
-do {
-mcr = ioc3_r_mcr();
-} while (!(mcr & 2));
+   do {
+   mcr = ioc3_r_mcr();
+   } while (!(mcr & 2));
 
-return mcr & 1;
+   return mcr & 1;
 }
 
-static int nic_reset(struct ioc3 *ioc3)
+static int
+nic_reset(struct ioc3 *ioc3)
 {
-int presence;
+   int presence;
 
ioc3_w_mcr(mcr_pack(500, 65));
presence = nic_wait(ioc3);
@@ -243,10 +248,11 @@ static int nic_reset(struct ioc3 *ioc3)
ioc3_w_mcr(mcr_pack(0, 500));
nic_wait(ioc3);
 
-return presence;
+   return presence;
 }
 
-static inline int