lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070301013201.e43ae3f5.akpm@linux-foundation.org>
Date:	Thu, 1 Mar 2007 01:32:01 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	bryan.wu@...log.com
Cc:	nico@....org, jgarzik@...ox.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH -mm 4/5] Blackfin: patch add blackfin support in smc91x
 ethernet controller driver

On Thu, 01 Mar 2007 17:23:23 +0800 "Wu, Bryan" <bryan.wu@...log.com> wrote:

> On Thu, 2007-03-01 at 00:54 -0800, Andrew Morton wrote:
> > On Thu, 01 Mar 2007 12:15:29 +0800 "Wu, Bryan" <bryan.wu@...log.com> wrote:
> > 
> > > +/* check if the mac in reg is valid */
> > > +#define SMC_GET_MAC_ADDR(addr)					\
> > > +	do {							\
> > > +		unsigned int __v;				\
> > > +		__v = SMC_inw( ioaddr, ADDR0_REG );		\
> > > +		addr[0] = __v; addr[1] = __v >> 8;		\
> > > +		__v = SMC_inw( ioaddr, ADDR1_REG );		\
> > > +		addr[2] = __v; addr[3] = __v >> 8;		\
> > > +		__v = SMC_inw( ioaddr, ADDR2_REG );		\
> > > +		addr[4] = __v; addr[5] = __v >> 8;		\
> > > +		if (*(u32 *)(&addr[0]) == 0xFFFFFFFF) {		\
> > > +			random_ether_addr(addr);		\
> > > +		}						\
> > > +	} while (0)
> > 
> > Please follow kernel coding style:
> > 
> > 	__v = SMC_inw(ioaddr, ADDR2_REG);
> > 

You skipped this:

> > Can this not be implemented as a C function?

> +#define SMC_GET_MAC_ADDR(addr)					\
> +	do {							\
> +		unsigned int __v;				\
> +		__v = SMC_inw(ioaddr, ADDR0_REG);		\
> +		addr[0] = __v; addr[1] = __v >> 8;		\
> +		__v = SMC_inw(ioaddr, ADDR1_REG);		\
> +		addr[2] = __v; addr[3] = __v >> 8;		\
> +		__v = SMC_inw(ioaddr, ADDR2_REG);		\
> +		addr[4] = __v; addr[5] = __v >> 8;		\
> +		if (*(u32 *)(&addr[0]) == 0xFFFFFFFF) {		\
> +			random_ether_addr(addr);		\
> +		}						\
> +	} while (0)

It can be, I think...

Please always prefer coding in C over coding in cpp.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ