All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 4/6] Create PHY Lib for U-Boot
Date: Wed, 6 Apr 2011 19:09:28 -0400	[thread overview]
Message-ID: <201104061909.29699.vapier@gentoo.org> (raw)
In-Reply-To: <1302040794-19837-5-git-send-email-afleming@freescale.com>

On Tuesday, April 05, 2011 17:59:52 Andy Fleming wrote:
> -#define debug(fmt,args...)	printf (fmt ,##args)
> +#define debug(fmt, args...)	printf(fmt, ##args)

it'd be nice if all these unrelated formatting changes werent intermingled.  
but i guess too hard for you to untangle now.  make it a pita to pick out what 
are functional changes and what is pure noise.

> +struct mii_dev *mdio_alloc(void)
> +{
> +	struct mii_dev *bus;
> +
> +	bus = malloc(sizeof(*bus));
> +	if (!bus)
> +		return bus;
> +
> +	memset(bus, 0, sizeof(*bus));
> +
> +	bus->name = malloc(MDIO_NAME_LEN);

considering the name len is hardcoded at build time, it'd be nice to inline 
that into the struct itself to avoid having to do multiple mallocs.  but i 
guess it might be hard to keep working with the legacy code ?  or maybe not if 
you just grep the tree to make sure no one using legacy code has a name longer 
than 31 bytes ...

> +struct phy_device *mdio_phydev_for_ethname(const char *ethname)
> ...
> +			if ((!bus->phymap[i]) || (!bus->phymap[i]->dev))

useless paren around both expressions here

> --- /dev/null
> +++ b/drivers/net/phy/phy.c
>
> +int phy_read(struct phy_device *phydev, int devad, int regnum)
> +{
> +	struct mii_dev *bus = phydev->bus;
> +
> +	return bus->read(bus, phydev->addr, devad, regnum);
> +}
> +
> +int phy_write(struct phy_device *phydev, int devad, int regnum, u16 val)
> +{
> +	struct mii_dev *bus = phydev->bus;
> +
> +	return bus->write(bus, phydev->addr, devad, regnum, val);
> +}

seems like it'd make sense for these to be inlines in the phy header

> +static struct phy_driver gen10g_driver = {
> +	.uid		= 0xffffffff,
> +	.mask		= 0xffffffff,
> +	.name		= "Generic 10G PHY",
> +	.features	= 0,
> +	.config		= gen10g_config,
> +	.startup	= gen10g_startup,
> +	.shutdown	= gen10g_shutdown,
> +};

this probably should be split out into a dedicated phy driver.  you might care 
about it, but i cant think of any board atm where i would use this.  i imagine 
for most people, it's simply useless bloat.

> +static struct phy_driver genphy_driver = {
> +	.uid		= 0xffffffff,
> +	.mask		= 0xffffffff,
> +	.name		= "Generic PHY",
> +	.features	= 0,
> +	.config		= genphy_config,
> +	.startup	= genphy_startup,
> +	.shutdown	= genphy_shutdown,
> +};

i think this should be split too for the board maintainers who know exactly 
why phy they're going to have in their system.

> +static struct list_head phy_drivers;
> +
> +int phy_init(void)
> +{
> +	INIT_LIST_HEAD(&phy_drivers);
> +
> +	return 0;
> +}

isnt there a macro for declaring/initializing a list structure statically ?  
then we could avoid this useless phy_init() call.

> +/* Indicates what features are supported by the interface. */
> +#define SUPPORTED_10baseT_Half		(1 << 0)
> +#define SUPPORTED_10baseT_Full		(1 << 1)
> +#define SUPPORTED_100baseT_Half		(1 << 2)

this stuff looks suspiciously like it was copy & pasted from linux/ethtool.h.  
why not just copy the file over instead of creating your own custom variant ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110406/05ece4d6/attachment.pgp 

  parent reply	other threads:[~2011-04-06 23:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-05 21:59 [U-Boot] [PATCH v2 0/6] Universal PHY Infrastructure Andy Fleming
2011-04-05 21:59 ` [U-Boot] [PATCH v2 1/6] tsec: use IO accessors for IO accesses Andy Fleming
2011-04-05 21:59   ` [U-Boot] [PATCH v2 2/6] tsec: arrange the code to avoid useless function declaration Andy Fleming
2011-04-05 21:59     ` [U-Boot] [PATCH v2 3/6] Remove instances of phy_read/write Andy Fleming
2011-04-05 21:59       ` [U-Boot] [PATCH v2 4/6] Create PHY Lib for U-Boot Andy Fleming
2011-04-05 21:59         ` [U-Boot] [PATCH v2 5/6] phylib: Add a bunch of PHY drivers from tsec Andy Fleming
2011-04-05 21:59           ` [U-Boot] [PATCH v2 6/6] tsec: Convert tsec to use PHY Lib Andy Fleming
2011-04-06 13:02             ` Detlev Zundel
2011-04-06 13:01           ` [U-Boot] [PATCH v2 5/6] phylib: Add a bunch of PHY drivers from tsec Detlev Zundel
2011-04-06 22:50           ` Mike Frysinger
2011-04-06 12:56         ` [U-Boot] [PATCH v2 4/6] Create PHY Lib for U-Boot Detlev Zundel
2011-04-06 23:09         ` Mike Frysinger [this message]
2011-04-07 14:16           ` Andy Fleming
2011-04-07 15:01             ` Wolfgang Denk
2011-04-07 19:37             ` Mike Frysinger
2011-04-07  4:43         ` Wolfgang Denk
2011-04-07  4:47           ` Mike Frysinger
2011-04-07  7:12             ` Wolfgang Denk
2011-04-07  5:19         ` Wolfgang Denk
2011-04-06 12:32       ` [U-Boot] [PATCH v2 3/6] Remove instances of phy_read/write Detlev Zundel
2011-04-06 12:31     ` [U-Boot] [PATCH v2 2/6] tsec: arrange the code to avoid useless function declaration Detlev Zundel
2011-04-06 12:29   ` [U-Boot] [PATCH v2 1/6] tsec: use IO accessors for IO accesses Detlev Zundel
2011-04-06 12:32     ` Kumar Gala
2011-04-06 12:07 ` [U-Boot] [PATCH v2 0/6] Universal PHY Infrastructure Detlev Zundel
2011-04-07 14:13   ` Andy Fleming
2011-04-07 19:43     ` Mike Frysinger
2011-04-08 11:44       ` Detlev Zundel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201104061909.29699.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.