From: Lucas Stach <l.stach@pengutronix.de>
To: Frank Li <lznuaa@gmail.com>
Cc: Frank Li <Frank.Li@freescale.com>,
Francois Romieu <romieu@fr.zoreil.com>,
Robert Schwebel <r.schwebel@pengutronix.de>,
David Miller <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Fabio Estevam <festevam@gmail.com>,
Shawn Guo <shawn.guo@linaro.org>
Subject: Re: [PATCH v3 1/1 net] net: fec: fix kernel oops when plug/unplug cable many times
Date: Mon, 06 May 2013 12:16:04 +0200 [thread overview]
Message-ID: <1367835364.4126.24.camel@weser.hi.pengutronix.de> (raw)
In-Reply-To: <CAHrpEqSDU6kkm9eRKLrc76LZJSjDDQsdzUC0=vS6ZE=spE14pQ@mail.gmail.com>
Am Montag, den 06.05.2013, 17:56 +0800 schrieb Frank Li:
> 2013/5/6 Lucas Stach <l.stach@pengutronix.de>:
> > Hi Frank,
> >
> > Am Donnerstag, den 02.05.2013, 08:55 +0800 schrieb Frank Li:
[...]
> >> diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
> >> index eb43729..a367b21 100644
> >> --- a/drivers/net/ethernet/freescale/fec.h
> >> +++ b/drivers/net/ethernet/freescale/fec.h
> >> @@ -260,7 +260,8 @@ struct fec_enet_private {
> >> int hwts_rx_en;
> >> int hwts_tx_en;
> >> struct timer_list time_keep;
> >> -
> >> + struct delayed_work delay_work;
> >> + int timeout;
> > I suspect you are going to add more variables like this in the future if
> > you are using the workqueue more extensively. This is a massive
> > pollution of the fec_enet_private struct. Please make this a bitfield
> > with a proper define for the timeout, so we can reuse one variable for
> > different tasks, or even split this out into it's own struct for the
> > delayed tasks.
>
> Bit | & is not atomic.
> So I prefer use two variable. the real work in delay work is very
> simple for future workaround.
Ah yes, that's right. Could you then please change the type of the
variable to bool to make it clear that nothing other than true/false
should go into this?
I would still prefer to group the delayed work related things together
in one struct to make the driver more readable overall. Like this:
struct fec_delayed_work {
struct delayed_work delay_work;
bool timeout;
bool future_workaround;
bool more_delayed_things;
};
And just include this struct in fec_enet_private.
--
Pengutronix e.K. | Lucas Stach |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5076 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
prev parent reply other threads:[~2013-05-06 10:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-02 0:55 [PATCH v3 1/1 net] net: fec: fix kernel oops when plug/unplug cable many times Frank Li
2013-05-02 20:48 ` David Miller
2013-05-06 7:47 ` Frank Li
2013-05-06 9:19 ` Lucas Stach
2013-05-06 9:56 ` Frank Li
2013-05-06 10:16 ` Lucas Stach [this message]
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=1367835364.4126.24.camel@weser.hi.pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=Frank.Li@freescale.com \
--cc=davem@davemloft.net \
--cc=festevam@gmail.com \
--cc=lznuaa@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=r.schwebel@pengutronix.de \
--cc=romieu@fr.zoreil.com \
--cc=shawn.guo@linaro.org \
/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).