From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B9B6C77B77 for ; Thu, 13 Apr 2023 14:48:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231253AbjDMOsq (ORCPT ); Thu, 13 Apr 2023 10:48:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230134AbjDMOsi (ORCPT ); Thu, 13 Apr 2023 10:48:38 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 803A4A253; Thu, 13 Apr 2023 07:48:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=I1L0Qp2sckfsIBhqUGSZAv87RBu9UChWVeSXNNEVCCg=; b=qjqaLyGI7RXtv0daQN4+J6UUp6 vjFwp9dg0vL6T9I+80Ockz/HfJhyoSXUn3hPGg1ig8MOC178Gpj0MrxrcBxzf/+2bovLIfMl/Ja2R FyRQk/E4CFAp1EXQjDYFAzqvTSuP+2dDLG7ccH23GOZ+bOCsGA0q4XO6rgCQjMYcbWXQ=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pmyFJ-00ACLu-AF; Thu, 13 Apr 2023 16:48:21 +0200 Date: Thu, 13 Apr 2023 16:48:21 +0200 From: Andrew Lunn To: Florian Fainelli Cc: Christian Marangi , Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: Re: [net-next PATCH v6 06/16] net: phy: phy_device: Call into the PHY driver to set LED brightness Message-ID: <9603636f-3296-4c6a-96ca-c522e91c1c4c@lunn.ch> References: <20230327141031.11904-1-ansuelsmth@gmail.com> <20230327141031.11904-7-ansuelsmth@gmail.com> <202ae4b9-8995-474a-1282-876078e15e47@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202ae4b9-8995-474a-1282-876078e15e47@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 13, 2023 at 06:57:51AM -0700, Florian Fainelli wrote: > > > On 3/27/2023 7:10 AM, Christian Marangi wrote: > > From: Andrew Lunn > > > > Linux LEDs can be software controlled via the brightness file in /sys. > > LED drivers need to implement a brightness_set function which the core > > will call. Implement an intermediary in phy_device, which will call > > into the phy driver if it implements the necessary function. > > > > Signed-off-by: Andrew Lunn > > Signed-off-by: Christian Marangi > > Reviewed-by: Florian Fainelli > > > + int (*led_brightness_set)(struct phy_device *dev, > > + u32 index, enum led_brightness value); > > I think I would have made this an u8, 4 billion LEDs, man, that's a lot! That can be done. We need to change: err = of_property_read_u32(led, "reg", &phyled->index); if (err) return err; to a u8, to avoid overflow problems in other places. It looks like of_property_read_u8() does the correct thing if somebody tried to use 4 billion - 1. Andrew