From: Andrew Lunn <andrew@lunn.ch>
To: Chris Healy <cphealy@gmail.com>
Cc: Russell King - ARM Linux <linux@armlinux.org.uk>,
Florian Fainelli <f.fainelli@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
kuba@kernel.org, netdev <netdev@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: sfp: Unique GPIO interrupt names
Date: Mon, 6 Jul 2020 22:07:42 +0200 [thread overview]
Message-ID: <20200706200742.GB893522@lunn.ch> (raw)
In-Reply-To: <CAFXsbZp5A7FHoXPA6Rg8XqZPD9NXmSeZZb-RsEGXnktbo04GOw@mail.gmail.com>
On Mon, Jul 06, 2020 at 12:38:37PM -0700, Chris Healy wrote:
> Dynamically generate a unique GPIO interrupt name, based on the
> device name and the GPIO name. For example:
>
> 103: 0 sx1503q 12 Edge sff2-los
> 104: 0 sx1503q 13 Edge sff3-los
>
> The sffX indicates the SFP the loss of signal GPIO is associated with.
Hi Chris
For netdev, please put inside the [PATCH] part of the subject, which
tree this is for, i.e. net-next.
> Signed-off-by: Chris Healy <cphealy@gmail.com>
> ---
> drivers/net/phy/sfp.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
> index 73c2969f11a4..9b03c7229320 100644
> --- a/drivers/net/phy/sfp.c
> +++ b/drivers/net/phy/sfp.c
> @@ -220,6 +220,7 @@ struct sfp {
> struct phy_device *mod_phy;
> const struct sff_data *type;
> u32 max_power_mW;
> + char sfp_irq_name[32];
>
> unsigned int (*get_state)(struct sfp *);
> void (*set_state)(struct sfp *, unsigned int);
> @@ -2349,12 +2350,15 @@ static int sfp_probe(struct platform_device *pdev)
> continue;
> }
>
> + snprintf(sfp->sfp_irq_name, sizeof(sfp->sfp_irq_name),
> + "%s-%s", dev_name(sfp->dev), gpio_of_names[i]);
> +
This is perfectly O.K, but you could consider using
devm_kasprintf(). That will allocate as much memory as needed for the
string, and hence avoid truncation issues, which we have seen before
with other interrupt names.
Andrew
next prev parent reply other threads:[~2020-07-06 20:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-06 19:38 [PATCH] net: sfp: Unique GPIO interrupt names Chris Healy
2020-07-06 20:07 ` Andrew Lunn [this message]
2020-07-06 23:03 ` Chris Healy
2020-07-06 20:42 ` Russell King - ARM Linux admin
2020-07-06 23:04 ` Chris Healy
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=20200706200742.GB893522@lunn.ch \
--to=andrew@lunn.ch \
--cc=cphealy@gmail.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.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).