Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp440304ybt; Mon, 6 Jul 2020 13:08:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzF55D/Xwz6latycBL+uuYqhZ+E67j5xER4XAhRWpBD9Z2Qe2Und2sHRh3+VUy81z3v11Vl X-Received: by 2002:aa7:c504:: with SMTP id o4mr56815300edq.311.1594066102021; Mon, 06 Jul 2020 13:08:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594066102; cv=none; d=google.com; s=arc-20160816; b=NPs1zJn2WYwQTuNI95R/4HpaykXCdXPtyxYrt9iY+MypnmsiGkewZXiBXe9Qvp3w1h Zk3UclTzsETdqZpAzCWpxTqu/QY+n1CDB6DIGGSz5FSgCTt2ciU2N1EidLqUHaLD07+N YwLzMyagY4uAMJDPLMIIsolSiwMNQ7Kvj6vC+zLdALYhCoMTQYbMtiNzb0q+PVT2n/o6 qfwgwcBUwu7SSBTndR+mVmY1Fmu4ARLFhSIptMcCMp+XOKmnhJufDOGUvrvuHeDygaJo IA8/a03TDtCVGYdCej61jGlBcRYVKX6QS4IwcGVgctUX213QXJrexvqY3T9iQNE9FEzn vgNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=fMvEOdKDSZ3BDtIA3yrZFS1GaH+oKg0LxQeeRORUgm0=; b=PUzSExzpGVsUJqRY1M0lrXoIXmnXcdXK8BIP21GsjNf38TywaWQgMk6a9qtmu0Nuhr 0cI6WVTHPf2pJXorKKFXzwaOS6wfXISbDsV948ZnHaT+6lSLsvdw/oRWaA171CXVCqqD CcfJmCuSAbx/gy29I2UwWpJhmVsZOXp76YdbACHZvZxggE/MdQoIry2hv2hoGH4LHsVb XbS9KiCOTTgty1DeR6VtuxacB4vWW7mci7ONClf437P/ZyNLE5cT6p6o9Lw/YT5g/X/c fATGa1c9s6blGKTqDT0t4g4uYFcSAGxE1lV1T4+NeNXZhrG/XEz+i2AYC22H7f/BU/va Ufhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x9si14193931edj.121.2020.07.06.13.07.58; Mon, 06 Jul 2020 13:08:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726831AbgGFUHr (ORCPT + 99 others); Mon, 6 Jul 2020 16:07:47 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:49832 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725892AbgGFUHr (ORCPT ); Mon, 6 Jul 2020 16:07:47 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1jsXOw-003uVe-Gw; Mon, 06 Jul 2020 22:07:42 +0200 Date: Mon, 6 Jul 2020 22:07:42 +0200 From: Andrew Lunn To: Chris Healy Cc: Russell King - ARM Linux , Florian Fainelli , Heiner Kallweit , "David S. Miller" , kuba@kernel.org, netdev , linux-kernel Subject: Re: [PATCH] net: sfp: Unique GPIO interrupt names Message-ID: <20200706200742.GB893522@lunn.ch> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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