From: Andy Fleming <afleming@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: richardcochran@gmail.com, netdev@vger.kernel.org
Subject: Re: [PATCH] phylib: Add support for the LXT973 phy.
Date: Mon, 7 Jun 2010 10:39:25 -0500 [thread overview]
Message-ID: <AANLkTim4kXRAQDnnlW_IkEA5bASWEiqlcvyaWhouUGKC@mail.gmail.com> (raw)
In-Reply-To: <20100607.011835.55846752.davem@davemloft.net>
On Mon, Jun 7, 2010 at 3:18 AM, David Miller <davem@davemloft.net> wrote:
> From: Richard Cochran <richardcochran@gmail.com>
> Date: Sat, 5 Jun 2010 16:00:17 +0200
>
>> On Wed, Jun 02, 2010 at 02:32:11PM -0500, Andy Fleming wrote:
>>> Yeah, I was clearly not thinking clearly. dev_flags will be
>>> overwritten, and is not meant for this. I believe, what we should do
>>> is add a "port" field to the PHY device, and if PCR_FIBER_SELECT is
>>> set, then set the port field to PORT_FIBRE. I'm not entirely clear on
>>> the semantics of that field in the ethtool cmd, but it seems like the
>>> right idea.
>>
>> Here is another try. Is that more like it?
>
> I think this is overkill.
Well, I meant for it to be the same as the ethtool one, and not a flags field.
>
> One, and only one, PHY driver wants to maintain a boolean state and
> we're adding a full 32-bit flags member to the generic PHY device
> struct to accomodate this?
To be fair, this is a generic problem, with a simple solution. I was
suggesting that a tiny patch would pave the way for others to follow
suit. Instead, now a tiny patch will do something strange and
incomprehensible, and then will be changed later when some arbitrary
threshold is reached of PHY drivers needing to know what type of port
they are hooked up to.
>
> Andy if you have ideas to use that state via ethtool or whatever in
> the future, you come back to us when the future arrives and you've
> implemented the code in the generic PHY lib code to do that stuff.
Is there some reason for resistance to taking small steps in the right
direction of an obviously good destination (recording the port type)?
At the very least, can I ask that instead of assigning phydev->priv to
the address of the probe function, that we do something like:
phydev->priv = (void *) PCR_FIBER_SELECT;
And then check to make sure it is that value? It's still hacky
(IMHO), but at least it's self-documenting.
>
> As it stands right now, that code doesn't exist so accomodating it is
> just silly.
>
> I also think worrying about the phy_dev->priv pointer being misused in
> the future inside of this driver is a completely bogus argument by any
> measure.
>
> We have many cases all over the kernel tree, in drivers and elsewhere,
> where we encode integer states in what are normally pointer values
> when we need to maintain a small piece of state and don't need to do a
> full blown memory allocation to allocate a piece of extra memory to
> hold that state.
I would consider it a case of last resort, for when you need to avoid
a memory allocation for performance reasons, and you must use a
generic structure for a non-generic task. This is something detected
in slow-path code, and is a generic task, so we're only hitting 1/3 of
those conditions. I won't speculate as to how many of those other
cases in the tree I would find annoying. ;)
Andy
next prev parent reply other threads:[~2010-06-07 15:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-31 13:09 [PATCH] phylib: Add support for the LXT973 phy Richard Cochran
2010-06-01 22:39 ` Andy Fleming
2010-06-02 12:55 ` Richard Cochran
2010-06-02 13:07 ` Richard Cochran
2010-06-02 13:50 ` David Miller
2010-06-02 15:08 ` Richard Cochran
2010-06-02 15:15 ` David Miller
2010-06-03 11:28 ` Richard Cochran
2010-06-02 19:32 ` Andy Fleming
2010-06-05 14:00 ` Richard Cochran
2010-06-07 8:18 ` David Miller
2010-06-07 15:39 ` Andy Fleming [this message]
2010-06-07 15:39 ` Richard Cochran
2010-06-09 23:17 ` David Miller
2010-06-22 12:38 ` [PATCH] phylib: Add autoload " David Woodhouse
2010-06-23 5:37 ` Richard Cochran
2010-06-23 9:00 ` David Woodhouse
2010-06-27 5:16 ` David Miller
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=AANLkTim4kXRAQDnnlW_IkEA5bASWEiqlcvyaWhouUGKC@mail.gmail.com \
--to=afleming@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
/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).