Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp541233ybt; Mon, 6 Jul 2020 16:03:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyI2B6QtDG6tKBy8s2YRtOH+iXeC3sg95t4gjxdrkpVpoleye5DjeXMK5x9ZY7HOESLOjUH X-Received: by 2002:a05:6402:1d97:: with SMTP id dk23mr59313222edb.1.1594076636793; Mon, 06 Jul 2020 16:03:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594076636; cv=none; d=google.com; s=arc-20160816; b=RFB6mTaOqhrNIpx+Pb6/NMtOKae2Ufw/xkZfH8pefifyxhNgsWlHOHa+cLhBJHhMBy cL1ysRZmqeSR0BO5Rt6OtfRvHgEcgjPUJtnD3SHXc4lH0V2olLZEJZuvT6LgVq8W1zTP KqZXMxWLn72elJI8F6mUl3DVz5lwYewS9FJkH5tFe/LsRCD3cRODBard2tnYw+aab0pG oir+mVAbnn/snZgdIaKupA1OPpowrY6A+rGImL7eXknnqTBY5ekqFcd7r8bFUCkMAyqe 3FCTeZKNuoVmjMyBWRXOUMcMMqZBUPxo7pdjxFPR0tqNTEDQsNHm78R2ZB5dwMsClk/P BRag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=UGk5VMo7016wWm4hFuTU503NGuLqOJi9iG46lhgQ9kQ=; b=aydX4URWwba6XVAkzrE/2VmokOT4j2/xP+kSQ9qUkw2mfeWb2NxJeAGD46ditLyEnf sxNvg8cuDVGUFLcDUhCoVGxT8SpsnuknEGN0h2LbpR9EHAVED/c2DFZUctfygee5n4Mo CcnwLqDy+ibBLCe6ja/7p+7xxu/FemZom6HlyvUQWQqjw3EQ+W+qNSmya3phytr8rRjN Wh22DF9vo9YRPUBEhI2Zuv2njEugmRoCgWm6oypzsgAPsWXIAGagKqtLbfhrhp31/tNi wgHxvdyXOtaOgG9gWpGOaVp+nV2J16i9so5IesFzHrm2qJCq5abo12TvlPYf2COhzPKv C95w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RemhuDYA; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j9si14297516edn.453.2020.07.06.16.03.33; Mon, 06 Jul 2020 16:03:56 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RemhuDYA; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727818AbgGFXDS (ORCPT + 99 others); Mon, 6 Jul 2020 19:03:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727058AbgGFXDR (ORCPT ); Mon, 6 Jul 2020 19:03:17 -0400 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77D3CC061755; Mon, 6 Jul 2020 16:03:17 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id f23so41207070iof.6; Mon, 06 Jul 2020 16:03:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UGk5VMo7016wWm4hFuTU503NGuLqOJi9iG46lhgQ9kQ=; b=RemhuDYAtzErC73fTdjuGrfZBTVuPaoW7+b2ZdoqwRXfLLcS0Lp9m1CuvKqY2+w2+r zdJQJbXoEzA0gnLtrq3SKi1HD6hGzRqTGFm9FmeiCPmYd3zqZ99Wuwg3ZJjI2EU+uqJT Dl0vJ3JyBS0nmbxb4++9vqPSamdIYSLzM53KvkL9FUH/HOoxPM8RY6/88Vr8LQpJlgdd Zs7B5d0/UYvcY5IP1QlOufzVDwmqDAZvO9I5zV/aZBaeCBnKP1S7Gx0jiseaEfbxEjT4 c3ZbPMbYgpAgN2LfEFS+L6PiIpayX7e0/DFFiJZXQAm3DCOU3wwjrKO9mb3Ufpp5nsvc nSKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UGk5VMo7016wWm4hFuTU503NGuLqOJi9iG46lhgQ9kQ=; b=BvMlAYcCNz94zdbIuPwG2XILxB0xDdz7YGkpjD2zic10CI1v6EjH55Fmt+lTMqL5mh 2m/Tnbu4hHVotQkGB6qxb6ksflq+8GMHwuDQ2UXcucll7NX8YsyaTrcDSfAJ5ri9TKQw tqRQRZ2Y6lVbCme8tZTNbErjphr43r4j3Hrov2NcgSNi546e0rnCGauvk17h+HIcMRAB cg6pHoJk7oZy0UJlCF80ew3CHG+w/vfEjc7Jy7FaxgcMbJL82WLiXlv1X6jSlvdCgmVM TZo2aHCm8VN+vzPqT5SzNttOJO1CmNXXgDGAtyWS2abDALVZ+P5O6UmpjAI2tSm1KyTx 85aQ== X-Gm-Message-State: AOAM531QAxzkDxZdnffpflUMbRZqozrxeDnvcOZfI9jcysMYLB1e0qDA SVFrcrgHbCQ8jdXADZJToxbK2Ib7KM3MrUqc80o= X-Received: by 2002:a05:6602:2c0a:: with SMTP id w10mr27688990iov.46.1594076596792; Mon, 06 Jul 2020 16:03:16 -0700 (PDT) MIME-Version: 1.0 References: <20200706200742.GB893522@lunn.ch> In-Reply-To: <20200706200742.GB893522@lunn.ch> From: Chris Healy Date: Mon, 6 Jul 2020 16:03:05 -0700 Message-ID: Subject: Re: [PATCH] net: sfp: Unique GPIO interrupt names To: Andrew Lunn Cc: Russell King - ARM Linux , Florian Fainelli , Heiner Kallweit , "David S. Miller" , kuba@kernel.org, netdev , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 6, 2020 at 1:07 PM Andrew Lunn wrote: > > 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. Will do. > > > 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. I'll give this a try for the next version of this patch. > > Andrew