Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp414238imu; Thu, 8 Nov 2018 10:00:54 -0800 (PST) X-Google-Smtp-Source: AJdET5ffChauo48RyjyokhnGIwlMeoEs1BjoYeYhEe6nm1LIqDOSldGT4GxNJ0enRJKt4U3AMF0y X-Received: by 2002:a17:902:8f8f:: with SMTP id z15-v6mr5488409plo.257.1541700053997; Thu, 08 Nov 2018 10:00:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541700053; cv=none; d=google.com; s=arc-20160816; b=HUe4F9sGveVmubfTUl8QDXTnOiQrFyxssP/+e5MYHW+jRKe00rqAsM8KazL6Y1M0lR 1jKjDGh+EG6T2b8QiSy58iFUDi85pEI3wBDNZgHX1j08+e449WDTqXa4uCTXVhG5Yosu U8ObAmpw3Dz6Njorns8tLelkbH3MFD3p5xRnySp315Y/PiFBYFC7m/+YVK9ix6l0kZbs zi3LEXNczGNE6kJKWiBcdfEXH4cogy2ekgLg8JCjrBnYLGoFL8XvYSON2C/gVnKAaz81 KVELo/wt/vs0qyHaTJ4U8zdT74JJue313pHXwd8Ljb0s5Qh/B7dlfq0EjiaRPpXsxSu+ t8CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature; bh=a3ZQ95EjHKvLIc50X3Fuqq5o9w1oaPKktFkHFIugYck=; b=Y/XH0O+iHa9Ds0i/5KxmqRK3qfrxbOmT+BpndClHanOAFCk4ig7XJanSbWoAqtYwCy 50rupW3Wqp8qGLXJprdR/Gfl0xhEONbMfxNkXrLCnG2bp5oBujVM7wistpmRH1PFpocD ukh43sDGoOtwD5cV962GDek75JgeTVs0+3gaBCyRB0M4qC151FIdjE5c9ti1DGZnyzZQ j6ZBZPCoO4gd7SjmbkKBhA1uvDsvuCZ6OISbp0HO7mOy6Pc8Cm/MZMgj8fa8heU+1Ymp MkLk5Gad261cQM1wz3eNwZ+StC7sybbl+CMLY7Lb7Q7Urow0in3gYmKTLf2rK7IrMEij zuJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GfmgDaOR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id b3-v6si4783473plx.106.2018.11.08.10.00.37; Thu, 08 Nov 2018 10:00:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GfmgDaOR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726967AbeKIDgl (ORCPT + 99 others); Thu, 8 Nov 2018 22:36:41 -0500 Received: from mail-yw1-f65.google.com ([209.85.161.65]:34823 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726634AbeKIDgl (ORCPT ); Thu, 8 Nov 2018 22:36:41 -0500 Received: by mail-yw1-f65.google.com with SMTP id w135-v6so8355366ywd.2; Thu, 08 Nov 2018 10:00:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=a3ZQ95EjHKvLIc50X3Fuqq5o9w1oaPKktFkHFIugYck=; b=GfmgDaORstRsBJAD5f/AIWsfsNNjaKSviT24zZq0HIz/H8nm9IID45ywVsCSz9tQFE vcVDtq4SsNKKFsrwUoZC7rbj0VKIrFXogIUviEm+eifiCsbmThH5y34lFsBjnv5O/R0R cB1FDB39rf/TYI4foNILYRm8fKAPX2lU8frPzWCt5bYYVvA5Yes4PMIuPunpb1DJVwLT +CrPtKMbPrOAUGQX0SsNfG1Q81kh65y8YRuIcArXkj3FtyXAR+MBBZM55KC0P5nMao8l WwFBsqBuOfgLqjIMeEG90wPMzYWDTGT5NFk/VfyULI2og1SCBOfY28fxtOqgzWGkDQeP t22Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=a3ZQ95EjHKvLIc50X3Fuqq5o9w1oaPKktFkHFIugYck=; b=TnMvgmKvILanvGRlx3kRzCj5XHYaPbhcmsjnGFogpT84uLKEpBhQuOODVSFkfDrYTB s2JKfbd01mNjMA72g7rtzViUSlKpjs2UUl6ZQSAZeQg7wUsFR8+M74AQCzF9QaiqcsVk audlfNOEXXvj4FRparbVuF++cBuGL6+1PimyQ3ghwILiLLjYDlGa3rOIlGbkxii3OE3E XN3ivREa7tPERLeHGXEmRTCp+H9m0dTiGDoREvN7UMrVhC4ui+LOkf+Zxr6+BMU5luAP 25Tgy6lkQnOX4yYIzO+FUIfknRzskGnydwkaSjOSjcJx7AHUbkuF+xtzhZmoddVznF8e htHg== X-Gm-Message-State: AGRZ1gKa3TmAlmJxpdljol9cs0EWiXiaPfzBbGy9ltia2iuUeJ/HYOw7 q0T7iL5V4WQBbu/BFhAJfGcfBie2 X-Received: by 2002:a81:ae64:: with SMTP id g36-v6mr5335076ywk.370.1541700001658; Thu, 08 Nov 2018 10:00:01 -0800 (PST) Received: from [10.67.49.62] ([192.19.223.250]) by smtp.googlemail.com with ESMTPSA id m16-v6sm3285567ywh.18.2018.11.08.10.00.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Nov 2018 10:00:00 -0800 (PST) Subject: Re: [PATCH] net: phy: leds: Don't make our own link speed names To: Kyle Roeschley , Andrew Lunn Cc: "David S . Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20181108175106.25684-1-kyle.roeschley@ni.com> From: Florian Fainelli Openpgp: preference=signencrypt Autocrypt: addr=f.fainelli@gmail.com; prefer-encrypt=mutual; keydata= xsDiBEjPuBIRBACW9MxSJU9fvEOCTnRNqG/13rAGsj+vJqontvoDSNxRgmafP8d3nesnqPyR xGlkaOSDuu09rxuW+69Y2f1TzjFuGpBk4ysWOR85O2Nx8AJ6fYGCoeTbovrNlGT1M9obSFGQ X3IzRnWoqlfudjTO5TKoqkbOgpYqIo5n1QbEjCCwCwCg3DOH/4ug2AUUlcIT9/l3pGvoRJ0E AICDzi3l7pmC5IWn2n1mvP5247urtHFs/uusE827DDj3K8Upn2vYiOFMBhGsxAk6YKV6IP0d ZdWX6fqkJJlu9cSDvWtO1hXeHIfQIE/xcqvlRH783KrihLcsmnBqOiS6rJDO2x1eAgC8meAX SAgsrBhcgGl2Rl5gh/jkeA5ykwbxA/9u1eEuL70Qzt5APJmqVXR+kWvrqdBVPoUNy/tQ8mYc nzJJ63ng3tHhnwHXZOu8hL4nqwlYHRa9eeglXYhBqja4ZvIvCEqSmEukfivk+DlIgVoOAJbh qIWgvr3SIEuR6ayY3f5j0f2ejUMYlYYnKdiHXFlF9uXm1ELrb0YX4GMHz80nRmxvcmlhbiBG YWluZWxsaSA8Zi5mYWluZWxsaUBnbWFpbC5jb20+wmYEExECACYCGyMGCwkIBwMCBBUCCAME FgIDAQIeAQIXgAUCVF/S8QUJHlwd3wAKCRBhV5kVtWN2DvCVAJ4u4/bPF4P3jxb4qEY8I2gS 6hG0gACff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FzcC1bjiW9mjW HaKaX23Awt97AqQZXegbfkJwX2Y53ufq8Np3e1542lh3/mpiGSilCsaTahEGrHK+lIusl6mz Joil+u3k01ofvJMK0ZdzGUZ/aPMZ16LofjFA+MNxWrZFrkYmiGdv+LG45zSlZyIvzSiG2lKy kuVag+IijCIom78P9jRtB1q1Q5lwZp2TLAJlz92DmFwBg1hyFzwDADjZ2nrDxKUiybXIgZp9 aU2d++ptEGCVJOfEW4qpWCCLPbOT7XBr+g/4H3qWbs3j/cDDq7LuVYIe+wchy/iXEJaQVeTC y5arMQorqTFWlEOgRA8OP47L9knl9i4xuR0euV6DChDrguup2aJVU8JPBBgRAgAPAhsMBQJU X9LxBQkeXB3fAAoJEGFXmRW1Y3YOj4UAn3nrFLPZekMeqX5aD/aq/dsbXSfyAKC45Go0YyxV HGuUuzv+GKZ6nsysJw== Message-ID: Date: Thu, 8 Nov 2018 09:59:53 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181108175106.25684-1-kyle.roeschley@ni.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/8/18 9:51 AM, Kyle Roeschley wrote: > The phy core provides a handy phy_speed_to_str() helper, so use that > instead of doing our own formatting of the different known link speeds. In case the speed is not supported, phy_speed_to_str() would return "Unsupported (update phy-core.c)" which is bigger (by 21 characters) than name_suffix. If you bumped name_suffix/PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE to 11 characters, that would be just large enough to accommodate for the "Unsupported" part of the string and that might be an acceptable solution in between. > > Signed-off-by: Kyle Roeschley > --- > drivers/net/phy/phy_led_triggers.c | 13 +------------ > 1 file changed, 1 insertion(+), 12 deletions(-) > > diff --git a/drivers/net/phy/phy_led_triggers.c b/drivers/net/phy/phy_led_triggers.c > index 491efc1bf5c4..2827eb413c9c 100644 > --- a/drivers/net/phy/phy_led_triggers.c > +++ b/drivers/net/phy/phy_led_triggers.c > @@ -77,20 +77,9 @@ static int phy_led_trigger_register(struct phy_device *phy, > struct phy_led_trigger *plt, > unsigned int speed) > { > - char name_suffix[PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE]; > - > plt->speed = speed; > - > - if (speed < SPEED_1000) > - snprintf(name_suffix, sizeof(name_suffix), "%dMbps", speed); > - else if (speed == SPEED_2500) > - snprintf(name_suffix, sizeof(name_suffix), "2.5Gbps"); > - else > - snprintf(name_suffix, sizeof(name_suffix), "%dGbps", > - DIV_ROUND_CLOSEST(speed, 1000)); > - > phy_led_trigger_format_name(phy, plt->name, sizeof(plt->name), > - name_suffix); > + phy_speed_to_str(speed)); > plt->trigger.name = plt->name; > > return led_trigger_register(&plt->trigger); > -- Florian