linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: Andy Fleming <afleming@freescale.com>
Cc: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>,
	netdev@vger.kernel.org, linuxppc-dev@ozlabs.org, olof@lixom.net
Subject: Re: [PATCH 05/14] phylib: add *_direct() variants of phy_connect and phy_attach functions
Date: Sat, 18 Apr 2009 00:18:35 -0600	[thread overview]
Message-ID: <fa686aa40904172318l55dba127jaf41b9c05186cc45@mail.gmail.com> (raw)
In-Reply-To: <fa686aa40904172308l38919bc0jfffbeb3a4106f582@mail.gmail.com>

On Sat, Apr 18, 2009 at 12:08 AM, Grant Likely
<grant.likely@secretlab.ca> wrote:
> On Wed, Apr 15, 2009 at 3:10 PM, Andy Fleming <afleming@freescale.com> wr=
ote:
>>
>> On Mar 31, 2009, at 3:27 AM, Grant Likely wrote:
>>
>>> From: Grant Likely <grant.likely@secretlab.ca>
>>>
>>> Add phy_connect_direct() and phy_attach_direct() functions so that
>>> drivers can use a pointer to the phy_device instead of trying to determ=
ine
>>> the phy's bus_id string.
>>>
>>> This patch is useful for OF device tree descriptions of phy devices whe=
re
>>> the driver doesn't need or know what the bus_id value in order to get a
>>> phy_device pointer.
>>>
>>> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
>>> ---
>>> @@ -312,18 +339,21 @@ struct phy_device * phy_connect(struct net_device
>>> *dev, const char *bus_id,
>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0phy_interface_t interface)
>>> {
>>> =A0 =A0 =A0 =A0struct phy_device *phydev;
>>> + =A0 =A0 =A0 struct device *d;
>>> + =A0 =A0 =A0 int rc;
>>>
>>> - =A0 =A0 =A0 phydev =3D phy_attach(dev, bus_id, flags, interface);
>>> -
>>> - =A0 =A0 =A0 if (IS_ERR(phydev))
>>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 return phydev;
>>> -
>>> - =A0 =A0 =A0 phy_prepare_link(phydev, handler);
>>> -
>>> - =A0 =A0 =A0 phy_start_machine(phydev, NULL);
>>> + =A0 =A0 =A0 /* Search the list of PHY devices on the mdio bus for the
>>> + =A0 =A0 =A0 =A0* PHY with the requested name */
>>> + =A0 =A0 =A0 d =3D bus_find_device_by_name(&mdio_bus_type, NULL, bus_i=
d);
>>> + =A0 =A0 =A0 if (!d) {
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pr_err("PHY %s not found\n", bus_id);
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return ERR_PTR(-ENODEV);
>>> + =A0 =A0 =A0 }
>>> + =A0 =A0 =A0 phydev =3D to_phy_device(d);
>>>
>>> - =A0 =A0 =A0 if (phydev->irq > 0)
>>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 phy_start_interrupts(phydev);
>>> + =A0 =A0 =A0 rc =3D phy_attach_direct(dev, phydev, flags, interface);
>>> + =A0 =A0 =A0 if (rc)
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return ERR_PTR(rc);
>>
>>
>> Why not just invoke phy_attach(), here, and thereby avoid the duplicate
>> search code?
>
> Yeah, you're right. =A0I had done it this way for symmetry, but calling
> phy_attach_direct is probably better.

Actually, no, my change is buggy.  I should be calling
phy_connect_direct() here, not phy_attach_direct().  Plus, either way
I do it there will be a few lines of duplicate code.  It will be fixed
in the next version.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

  reply	other threads:[~2009-04-18  6:18 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-31  8:26 [PATCH 00/14] Add common OF device tree support for MDIO busses Grant Likely
2009-03-31  8:26 ` [PATCH 01/14] of: add of_parse_phandle() helper for parsing phandle properties Grant Likely
2009-03-31  8:26 ` [PATCH 02/14] net/fec_mpc52xx: Migrate to net_device_ops Grant Likely
2009-03-31  8:26 ` [PATCH 03/14] net/fec_mpc52xx: Don't dereference phy_device if it is NULL Grant Likely
2009-03-31  8:27 ` [PATCH 04/14] phylib: rework to prepare for OF registration of PHYs Grant Likely
2009-03-31  8:27 ` [PATCH 05/14] phylib: add *_direct() variants of phy_connect and phy_attach functions Grant Likely
2009-04-15 21:10   ` Andy Fleming
2009-04-18  6:08     ` Grant Likely
2009-04-18  6:18       ` Grant Likely [this message]
2009-03-31  8:27 ` [PATCH 06/14] openfirmware: Add OF phylib support code Grant Likely
2009-03-31  8:27 ` [PATCH 07/14] net: Rework mpc5200 fec driver to use of_mdio infrastructure Grant Likely
2009-03-31  8:27 ` [PATCH 08/14] net: rework fsl_pq_mdio " Grant Likely
2009-03-31  8:27 ` [PATCH 09/14] net: Rework gianfar " Grant Likely
2009-04-15 23:01   ` Andy Fleming
2009-04-18  6:34     ` Grant Likely
2009-03-31  8:27 ` [PATCH 10/14] net: Rework ucc_geth " Grant Likely
2009-03-31  8:27 ` [PATCH 11/14] net: Rework pasemi_mac " Grant Likely
2009-03-31  8:27 ` [PATCH 12/14] powerpc/82xx: Rework Embedded Planet ep8248e platform to use of_mdio Grant Likely
2009-03-31  8:27 ` [PATCH 13/14] net: Rework fs_enet driver to use of_mdio infrastructure Grant Likely
2009-03-31  8:27 ` [PATCH 14/14] net: add Xilinx ll_temac device driver Grant Likely
2009-03-31 21:57 ` [PATCH 00/14] Add common OF device tree support for MDIO busses David Miller
2009-03-31 22:19   ` Grant Likely
2009-03-31 22:22     ` David Miller
2009-04-01  1:45       ` Grant Likely
2009-04-01  3:38         ` David Miller
2009-04-01  4:56           ` Grant Likely
2009-04-01  5:16             ` David Miller
2009-04-01  5:21               ` Grant Likely
2009-04-15 23:06 ` Andy Fleming

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=fa686aa40904172318l55dba127jaf41b9c05186cc45@mail.gmail.com \
    --to=grant.likely@secretlab.ca \
    --cc=Joakim.Tjernlund@transmode.se \
    --cc=afleming@freescale.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=netdev@vger.kernel.org \
    --cc=olof@lixom.net \
    /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 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).