Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2603356rbb; Wed, 28 Feb 2024 07:04:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUQwU0bBJZ/z5ZshNOe7BVIwLjNH89XTF1DVhMvzSGrPGk98BTm8skDSpZR5Wfb07RQ7MRx7m12+hd3ScC+rlqH6SIGbFqa6jJnVwdJnQ== X-Google-Smtp-Source: AGHT+IFPFQ38jzqVIro1Sp3xYVn9ZnjxVdRedXEahUn6AhiX+J0sA7L9IZlowCF8XzHs3pECnp30 X-Received: by 2002:a6b:4e12:0:b0:7c7:dca3:7e27 with SMTP id c18-20020a6b4e12000000b007c7dca37e27mr8185877iob.17.1709132667039; Wed, 28 Feb 2024 07:04:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709132667; cv=pass; d=google.com; s=arc-20160816; b=SOjWddBgiBdB7C9KIS/qizR8mMThRewedU0gZH8zgro43BNsX8u5fKMF4rvayTmdbx 7LjUnL6U2H3pSOixyGH6jAsrtufWEtHF+ka8V7IrPObL/W6a/epV17fCnL3mHOAEavxY LGWVLulPkACFlwDgfiRWTK3Br2xKcHe4F9DiQM406P1r1bA1mtdPeRlYmhApH/nF0Yps 2VwL7S9SNv02Rt9XVNFWze5PE7C2GIk+kBYKo8mdTSGc69xTuBPmsDxPSnThBZzZHacC xLZyW5HcNbrloSvwjcnFaaaGQwusMuhtP8EuKU05hLo5QjV6Y4j+enyS86dA1Qvlt2+A hLgg== ARC-Message-Signature: i=2; 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=dOocNfIFOpPF6lqMWSXAW9AMnznAJXSj9KJvDupMxYg=; fh=SqVNk/AEsshgNi9P/J/8peWi9QS/qxYlXeemt/D/8xE=; b=VOSddx8PREGJTP+W1okr5UHj7TZtwQrmdWYHhuuowI7SWMglhTSQXqINADrbfl7N+H jFZmKbXLbFFexIhi4QJtb1q3u8U3ExTsV92KD+8MyhRe2OkFdGBzmWeUp1t+qyR1Dc80 ij5zCLEJx4TgCwdNXxrHBHY2lhUFOo0vCmdu/E2I9vsW7qdpzW7b1QLymEF4yEV/P1yH GxbE+iz268JlsGv/DXC7v8EDOP1fP6HgBYIw+vwIYauNlgtM9a3vWZLzGu+ZjI924dYJ ABze+RnVmnCV6NvXNVhvaKxO1R0+vebroNTKHqm29RbC0GQa+OVdpiA/T36WPN9YPNE+ nrJg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=bTUZz3v4; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-85233-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85233-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id m19-20020a056638271300b004746cb86fe0si3202806jav.73.2024.02.28.07.04.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 07:04:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85233-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=bTUZz3v4; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-85233-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85233-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B7CDD284CA8 for ; Wed, 28 Feb 2024 15:04:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E518214A4D6; Wed, 28 Feb 2024 15:04:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="bTUZz3v4" 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 6A9E224B39; Wed, 28 Feb 2024 15:04:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709132658; cv=none; b=Rl3otR9/UF6Of4xCJQgPwkR6u4nMqz4TvBd3kINcxbtICgeQCX5RNOgc84czynPmxg9Jx1mAVWmQIfStL1uoaUeeD0lqB9fxLQdTJATsYLhgoTU5lV2np0zsyPfSTEGq0AJ4W0Q5WYLVfpZPdhHAWjYJ3QQjGtm/BGmnux0csc8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709132658; c=relaxed/simple; bh=t9muqhfNN7i4XP7gG3jCRjrTS9ve2WB+DxxVMTVNZA8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZLkIYbq8+C8Ls3AiwU/URcwv0t20XN4ewV/guflYmq+Ot0mVkFtFJ8PKf4l1lEHz23xSVGbJGDP5w4S6J1AEav/UznGYLf6rgvC09ljSQRuP2LA1P7ISbYaujtGLcqu4EvSnQTI0ysmsBVl2FKOMZkMu2d3BlhlMtNS9p1kPCF4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=bTUZz3v4; arc=none smtp.client-ip=156.67.10.101 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=dOocNfIFOpPF6lqMWSXAW9AMnznAJXSj9KJvDupMxYg=; b=bTUZz3v4hxXRRqqLkvtLScD7qZ /WpJG7GUplG1kh3IxUbHuJznV7aCXbWselztd5/1OrNEIjX4DPWCAT3nwjZus2EnfKmMELkcf/8IJ J4b7cgWKvuKSxI+sC5x58oWQ0WEsz0TGSxx/d5ZvgMMy8WpyRjH7+YsKq1ZugZII140Q=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rfLTn-008xT3-DF; Wed, 28 Feb 2024 16:04:19 +0100 Date: Wed, 28 Feb 2024 16:04:19 +0100 From: Andrew Lunn To: Bastien Curutchet Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Pavel Machek , Lee Jones , Richard Cochran , Heiner Kallweit , Russell King , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-leds@vger.kernel.org, Thomas Petazzoni , herve.codina@bootlin.com, maxime.chevallier@bootlin.com, christophercordahi@nanometrics.ca Subject: Re: [PATCH v2 3/6] net: phy: DP83640: Add LED handling Message-ID: <9b06003c-afc9-419a-af36-7b81aab8517e@lunn.ch> References: <20240227093945.21525-1-bastien.curutchet@bootlin.com> <20240227093945.21525-4-bastien.curutchet@bootlin.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: <20240227093945.21525-4-bastien.curutchet@bootlin.com> > +static int dp83640_led_brightness_set(struct phy_device *phydev, u8 index, > + enum led_brightness brightness) > +{ > + int val; > + > + if (index > DP83640_SPDLED_IDX) > + return -EINVAL; > + > + phy_write(phydev, PAGESEL, 0); > + > + val = phy_read(phydev, LEDCR) & ~DP83640_LED_DIS(index); > + val |= DP83640_LED_DRV(index); > + if (brightness) > + val |= DP83640_LED_VAL(index); > + else > + val &= ~DP83640_LED_VAL(index); > + phy_write(phydev, LEDCR, val); I don't understand this driver too well, but should this be using ext_read() and ext_write(). I'm also woundering if it would be good to implement the .read_page and .write_page members in phy_driver and then use phy_write_paged() and phy_write_paged() and phy_modify_paged(), which should do better locking. Andrew