Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7705350rdb; Thu, 4 Jan 2024 05:21:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/kU2w8sZU+05SpY7Hrsj8yJkm9XRPRQBakHkaVzFWMBLV6hRVDFZk9mxsEpKBaR63x9Dw X-Received: by 2002:a05:620a:119a:b0:781:65d0:5d5c with SMTP id b26-20020a05620a119a00b0078165d05d5cmr601035qkk.38.1704374473239; Thu, 04 Jan 2024 05:21:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704374473; cv=none; d=google.com; s=arc-20160816; b=Xm0cSwRNwbmr3wSAnz7KqMY9KMUPDFG3OoijducYtCItoeWu7IJ3rkedLnqpQFsAeK E72NZwNIZGA2zMkjRPgqyMTkzmUwI5SH3jspqdBzNZARaOah6sf0YydS/XavA4eDQRhe HwV0A38CNQV0EX/ziznhn77A2grx0nWy+0z2UzTihqKWgMnN6B1ljSCq4pHjCA6KcGUa J6S6DMtQjPzupefROeA6cIvLYwh+7sQvRJnqnSl3eJUDVQOSk/qIrE0nuWbd4LIQ9H3H EbNYT9WRAYL2aZOL9PhqImeKnaVXJZJ7n6btfEQvzP9TRIYBUygndfzgRN9Q95YHO6+v WM1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Yjf0yIFfs+i6yyGRMaFNHLw0zbWSp5xq8DiLwHvL6ew=; fh=f2530uQuFU6gTjydPfA47iMPP96/zmYeGuzVqpEDVHE=; b=n2nJzv+GojTgy85rYrIgCzVekyvHNGsA1dgIwDCvq1hzUaj/9Pq+mz64ciTw026sI3 u+L/2Icq7qc5NBuFGSqKf1B4BW1aEFkSsETqM/1jt13/klErZfXeCRDcAy1mrMSgmBNc e9rvTSbxJbXSo7Bng2v02tMZffQepsgvpf2GcsJBWvX43V9iWpMZhq24qoLh1s21UCIY Ns6/ZPqBWkVOznft7hAoDfxnm4q/ngUu1+rFqUX3mUOCj6Z0Kf0jmhADvymtxF6x5uh0 MKox3okq5yoxt2knt/hIcr0psVfETR/fbyJJajYYfjARCXa1GDbvRab/xCCtYqUnIjEv yhTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=UihrHtrq; spf=pass (google.com: domain of linux-kernel+bounces-16698-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16698-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id z8-20020a05620a260800b007816e434d6fsi18377360qko.342.2024.01.04.05.21.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 05:21:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16698-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=UihrHtrq; spf=pass (google.com: domain of linux-kernel+bounces-16698-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16698-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id AE2561C23EA6 for ; Thu, 4 Jan 2024 13:21:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9CCC42233C; Thu, 4 Jan 2024 13:21:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="UihrHtrq" X-Original-To: linux-kernel@vger.kernel.org Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56DF421374; Thu, 4 Jan 2024 13:21:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch 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=Yjf0yIFfs+i6yyGRMaFNHLw0zbWSp5xq8DiLwHvL6ew=; b=UihrHtrq21yZ8dwOFw43Jyiq5G zwvFwzPZ0ivxq7HFSxubc1TOoou+OaqF1DIoomhRZ85CtQvTWhf1OH23RR8zOr4rVgwpKMfrLEQwF a1VJCSdXa/YSQxnoq2MQ8Q1OsLJip8AAPbB+tLmKpMYnp+ilssBcZJQrAbDmKryqnV/k=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rLNeP-004LlA-HB; Thu, 04 Jan 2024 14:20:45 +0100 Date: Thu, 4 Jan 2024 14:20:45 +0100 From: Andrew Lunn To: Christian Marangi Cc: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , William Zhang , Anand Gore , Kursad Oney , Florian Fainelli , =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , Broadcom internal kernel review list , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Jacek Anaszewski , =?iso-8859-1?Q?Fern=E1ndez?= Rojas , Sven Schwermer , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org Subject: Re: [net-next PATCH v8 3/5] net: phy: add support for PHY LEDs polarity modes Message-ID: <47f18def-d34f-4224-9de2-6e0ae7122a52@lunn.ch> References: <20240104110114.2020-1-ansuelsmth@gmail.com> <20240104110114.2020-4-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240104110114.2020-4-ansuelsmth@gmail.com> > + if (phydev->drv->led_polarity_set) { > + if (of_property_read_bool(led, "active-low")) > + set_bit(PHY_LED_ACTIVE_LOW, &modes); > + if (of_property_read_bool(led, "inactive-high-impedance")) > + set_bit(PHY_LED_INACTIVE_HIGH_IMPEDANCE, &modes); > + > + err = phydev->drv->led_polarity_set(phydev, index, modes); > + if (err) > + return err; > + } I think we should return an error if asked to set the mode, but its not implemented by the driver. Something like: if (of_property_read_bool(led, "active-low")) set_bit(PHY_LED_ACTIVE_LOW, &modes); if (of_property_read_bool(led, "inactive-high-impedance")) set_bit(PHY_LED_INACTIVE_HIGH_IMPEDANCE, &modes); if (mode) if (phydev->drv->led_polarity_set) { return -EINVAL; } else { err = phydev->drv->led_polarity_set(phydev, index, modes); if (err) return err; } } > + /** > + * @led_polarity_set: Set the LED polarity if active low The 'if active low' is not ouw of date, since it is used for more than that. > + * @dev: PHY device which has the LED > + * @index: Which LED of the PHY device or -1 > + * @modes: bitmap of LED polarity modes > + * > + * Configure LED with all the required polarity modes in @modes > + * to make it correctly turn ON or OFF. index == -1 should be explained. > + * > + * Returns 0, or an error code. > + */ > + int (*led_polarity_set)(struct phy_device *dev, int index, > + unsigned long modes); Andrew --- pw-bot: cr