[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <46FDE26C.6010000@garzik.org>
Date: Sat, 29 Sep 2007 01:28:12 -0400
From: Jeff Garzik <jeff@...zik.org>
To: Stephen Hemminger <shemminger@...ux-foundation.org>
CC: Al Viro <viro@....linux.org.uk>,
Francois Romieu <romieu@...zoreil.com>, netdev@...r.kernel.org
Subject: Re: [PATCH] via-velocity: more cleanup
Stephen Hemminger wrote:
> Per Al's suggestion, get rid of the stupid stuff:
> Remove cam_type switch,
> And deinline things that aren't important for speed.
> And make big macro and inline.
> And remove some dead/unused code.
> And use const char * for chip name.
>
> Signed-off-by: Stephen Hemminger <shemminger@...ux-foundation.org>
>
>
> --- a/drivers/net/via-velocity.c 2007-08-24 13:49:17.000000000 -0700
> +++ b/drivers/net/via-velocity.c 2007-08-24 14:39:14.000000000 -0700
> @@ -85,6 +85,163 @@
> static int velocity_nics = 0;
> static int msglevel = MSG_LEVEL_INFO;
>
> +/**
> + * mac_get_cam_mask - Read a CAM mask
> + * @regs: register block for this velocity
> + * @mask: buffer to store mask
> + *
> + * Fetch the mask bits of the selected CAM and store them into the
> + * provided mask buffer.
> + */
> +
> +static void mac_get_cam_mask(struct mac_regs __iomem * regs, u8 * mask)
> +{
> + int i;
> +
> + /* Select CAM mask */
> + BYTE_REG_BITS_SET(CAMCR_PS_CAM_MASK, CAMCR_PS1 | CAMCR_PS0, ®s->CAMCR);
> +
> + writeb(0, ®s->CAMADDR);
> +
> + /* read mask */
> + for (i = 0; i < 8; i++)
> + *mask++ = readb(&(regs->MARCAM[i]));
> +
> + /* disable CAMEN */
> + writeb(0, ®s->CAMADDR);
> +
> + /* Select mar */
> + BYTE_REG_BITS_SET(CAMCR_PS_MAR, CAMCR_PS1 | CAMCR_PS0, ®s->CAMCR);
> +
> +}
> +
> +
> +/**
> + * mac_set_cam_mask - Set a CAM mask
> + * @regs: register block for this velocity
> + * @mask: CAM mask to load
> + *
> + * Store a new mask into a CAM
> + */
> +
> +static void mac_set_cam_mask(struct mac_regs __iomem * regs, u8 * mask)
> +{
> + int i;
> + /* Select CAM mask */
> + BYTE_REG_BITS_SET(CAMCR_PS_CAM_MASK, CAMCR_PS1 | CAMCR_PS0, ®s->CAMCR);
> +
> + writeb(CAMADDR_CAMEN, ®s->CAMADDR);
> +
> + for (i = 0; i < 8; i++) {
> + writeb(*mask++, &(regs->MARCAM[i]));
> + }
> + /* disable CAMEN */
> + writeb(0, ®s->CAMADDR);
> +
> + /* Select mar */
> + BYTE_REG_BITS_SET(CAMCR_PS_MAR, CAMCR_PS1 | CAMCR_PS0, ®s->CAMCR);
> +}
I applied both your via-velocity cleanups. For future patches, please
always separate code movement into a separate patch from other cleanups.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists