netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] tulip: cleanup by using ARRAY_SIZE()
@ 2014-01-23  8:26 Dan Carpenter
  2014-01-23 16:46 ` Grant Grundler
  2014-01-23 21:29 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2014-01-23  8:26 UTC (permalink / raw)
  To: Grant Grundler; +Cc: netdev, David S. Miller, kernel-janitors

In this situation then ARRAY_SIZE() and sizeof() are the same, but we're
really dealing with array indexes and not byte offsets so ARRAY_SIZE()
is cleaner.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/ethernet/dec/tulip/media.c b/drivers/net/ethernet/dec/tulip/media.c
index 0d0ba725341a..dcf21a36a9cf 100644
--- a/drivers/net/ethernet/dec/tulip/media.c
+++ b/drivers/net/ethernet/dec/tulip/media.c
@@ -457,7 +457,7 @@ void tulip_find_mii(struct net_device *dev, int board_idx)
 	/* Find the connected MII xcvrs.
 	   Doing this in open() would allow detecting external xcvrs later,
 	   but takes much time. */
-	for (phyn = 1; phyn <= 32 && phy_idx < sizeof (tp->phys); phyn++) {
+	for (phyn = 1; phyn <= 32 && phy_idx < ARRAY_SIZE(tp->phys); phyn++) {
 		int phy = phyn & 0x1f;
 		int mii_status = tulip_mdio_read (dev, phy, MII_BMSR);
 		if ((mii_status & 0x8301) == 0x8001 ||

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

* Re: [patch] tulip: cleanup by using ARRAY_SIZE()
  2014-01-23  8:26 [patch] tulip: cleanup by using ARRAY_SIZE() Dan Carpenter
@ 2014-01-23 16:46 ` Grant Grundler
  2014-01-23 21:29 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Grant Grundler @ 2014-01-23 16:46 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Grant Grundler, open list:TULIP NETWORK DRI..., David S. Miller,
	kernel-janitors

On Thu, Jan 23, 2014 at 12:26 AM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:
> In this situation then ARRAY_SIZE() and sizeof() are the same, but we're
> really dealing with array indexes and not byte offsets so ARRAY_SIZE()
> is cleaner.

Yup.

> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Grant Grundler <grundler@parisc-linux.org>

cheers
grant
>
> diff --git a/drivers/net/ethernet/dec/tulip/media.c b/drivers/net/ethernet/dec/tulip/media.c
> index 0d0ba725341a..dcf21a36a9cf 100644
> --- a/drivers/net/ethernet/dec/tulip/media.c
> +++ b/drivers/net/ethernet/dec/tulip/media.c
> @@ -457,7 +457,7 @@ void tulip_find_mii(struct net_device *dev, int board_idx)
>         /* Find the connected MII xcvrs.
>            Doing this in open() would allow detecting external xcvrs later,
>            but takes much time. */
> -       for (phyn = 1; phyn <= 32 && phy_idx < sizeof (tp->phys); phyn++) {
> +       for (phyn = 1; phyn <= 32 && phy_idx < ARRAY_SIZE(tp->phys); phyn++) {
>                 int phy = phyn & 0x1f;
>                 int mii_status = tulip_mdio_read (dev, phy, MII_BMSR);
>                 if ((mii_status & 0x8301) == 0x8001 ||

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

* Re: [patch] tulip: cleanup by using ARRAY_SIZE()
  2014-01-23  8:26 [patch] tulip: cleanup by using ARRAY_SIZE() Dan Carpenter
  2014-01-23 16:46 ` Grant Grundler
@ 2014-01-23 21:29 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-01-23 21:29 UTC (permalink / raw)
  To: dan.carpenter; +Cc: grundler, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Thu, 23 Jan 2014 11:26:37 +0300

> In this situation then ARRAY_SIZE() and sizeof() are the same, but we're
> really dealing with array indexes and not byte offsets so ARRAY_SIZE()
> is cleaner.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks Dan.

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

end of thread, other threads:[~2014-01-23 21:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-23  8:26 [patch] tulip: cleanup by using ARRAY_SIZE() Dan Carpenter
2014-01-23 16:46 ` Grant Grundler
2014-01-23 21:29 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).