Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp458718lqb; Wed, 29 May 2024 00:09:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXBwUQ/fcY3VO0uoAypXubiwQkLOa6yc910LnotqOeAtPEciS/XwvOF+isZEwR7juwdSW3WMS213R6cvgfQA3hwaXVXNBx40rM6uFaG7g== X-Google-Smtp-Source: AGHT+IEVm/5mn3NPQ0/thysBxXs4aZYbe1HAahki8dfyXQkXLQwBhoYwlYr/A6UdkTmsIdUlwacq X-Received: by 2002:a05:620a:4006:b0:78d:67de:50a0 with SMTP id af79cd13be357-794ab0d4194mr2121358485a.44.1716966570823; Wed, 29 May 2024 00:09:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716966570; cv=pass; d=google.com; s=arc-20160816; b=cneMiaEqSGudtC1WqjxyjosE/ktGR9mZk7CQmwpT2xYZJo61mTYvz6gPL2l+/lBOnB 4uP2cC9B81TrtFbR5DLyUaDBBa7z3KKldJc7B4Yl7vti+1S0hbNRrzxn/1VJs5RkEgJM q+xebNCHquKKRqeknhSnmFes4r3OZBzAPE3iWiVHFuQ0T9aXPJ0AqLrQ22j9wmUXRDgT T5nL/4xsEXPQHTxSU4hwsjrqZfr9QvvXR1GeBzlbR/Yttq4FSZG/rjPyh8wX+UZifGQP tQGc++dYFpm4ogTueuIrODsMdT60he87zJaLZju6SK0SfAB5OFLoSWuUehL8JDZJ4dys pIFw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=UlURmdwSkTZ6d+R8gxWv4ItfcxxXI6BCmBlftQ7cRKY=; fh=oTz0KMt9aE8PTy/+WBvmbT5yLjvoAhBSJT7P7/ACB5s=; b=A86iKuEE2AveWgDSOUZrEFDUea5UZ2FgZ1Yo/1XQRNqMp8/sgDoHa2HF7zCzGBbVs6 Dv247k6a8IuruOoTVKVzgGT3EojT4QK1hIonVaIX2ZFUU0aVEm3fEu2UG8CDVn0I/E0L lZSgvk7ubNJjembrA7cATu+8xk64kzLEEjcQMRfGsS9wtsaQYLQeqiE9ced/AuQA6JVA zBvOwyXvgY9zn4inha2cbCJanrcS0diVZYWRiDY9V0S9xVul+7hSAl/ggBJVM7rWH+Hn FAlpVAJpdRPmTLdGA4226E9N6aV1PB2W/B4a+C02DOGKmpMjH0lPHHrt8z+RXUvTBiOh dItQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Zwtn5GH4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-193561-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193561-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794abcab7acsi1170399585a.92.2024.05.29.00.09.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 00:09:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-193561-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=@kernel.org header.s=k20201202 header.b=Zwtn5GH4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-193561-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193561-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 817FE1C22C7E for ; Wed, 29 May 2024 07:09:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5CA901667E1; Wed, 29 May 2024 07:09:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Zwtn5GH4" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 728042F32; Wed, 29 May 2024 07:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716966562; cv=none; b=Rc0LlweO9/H1XVJhVrdTMEJwmOxxgaveJ3JqspcFU5RdY/djzCTHeZ4kXeVOqVuxbi2Tm7CXvmUe0+iktxD4tV3IHQ9BrV2IihhsPqQuvKs7NIkeO7U9hO8aFhBpC62f2vjYFFbEcPhLZnUIwKf4l0tKG1s9XnE7JvL46IJFxzc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716966562; c=relaxed/simple; bh=f5hieK2dVR8m72dQIfBgiq+09hpzZd5FvWTa+h7XuwE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=qFy7ACFv25O3oEU/81fJclTZeCrJPzq+YQHdjEmJmGcj/OT46SksrMB3ga04AMjYMLf0klrDY2PtiGbIs3w0h2BAWugHt6e5OeGft7sXVDPNg5iBDG5tWyMOWOf6ZxKyJeXOhgliEwD3eHYEVX9skHsS2QJw2hfkomiKhihb2Ac= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Zwtn5GH4; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1946EC32781; Wed, 29 May 2024 07:09:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716966562; bh=f5hieK2dVR8m72dQIfBgiq+09hpzZd5FvWTa+h7XuwE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Zwtn5GH46/BmFtgUJT0+jA7hR7JDwcnFzmA0BATIWfjv5BXGGAg/M97xp413hLwKT ukOAy06EaXNN3N8OkhoYg3jVYB1t4jLpdXiq6UuDHY5V3n44TjahRAU2qrarbPo082 8TZ9B06t1rska/zP7jrW4i+Ualycb5ckwb4r+pyvwdcfQChqaPrxNQ7UCldpUiL8Hl pXrPuEEHhuXx4y2vNqhrkABsjI15C1rmKMshWdiLHONwpBiXhHtKTVA8VZU2aKWH05 E55qfSlprcDD5Z74HWagCqu7WwqfgoTF4ddF5xUxNnb/5JLV7l7wd854JrjXoE57vv fMpKi1M340ybg== Message-ID: <3531ac76-bcee-4c4d-8396-65b5dfbd8df9@kernel.org> Date: Wed, 29 May 2024 09:09:17 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] hwmon: (ina2xx) Add device tree support to pass alert polarity To: Amna Waseem , Jean Delvare , Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@axis.com References: <20240529-apol-ina2xx-fix-v1-0-77b4b382190f@axis.com> <20240529-apol-ina2xx-fix-v1-2-77b4b382190f@axis.com> From: Krzysztof Kozlowski Content-Language: en-US Autocrypt: addr=krzk@kernel.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARAQABzSVLcnp5c3p0b2Yg S296bG93c2tpIDxrcnprQGtlcm5lbC5vcmc+wsGVBBMBCgA/AhsDBgsJCAcDAgYVCAIJCgsE FgIDAQIeAQIXgBYhBJvQfg4MUfjVlne3VBuTQ307QWKbBQJgPO8PBQkUX63hAAoJEBuTQ307 QWKbBn8P+QFxwl7pDsAKR1InemMAmuykCHl+XgC0LDqrsWhAH5TYeTVXGSyDsuZjHvj+FRP+ gZaEIYSw2Yf0e91U9HXo3RYhEwSmxUQ4Fjhc9qAwGKV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RIBE+NUqckM+3zJHGmVPqJP/h2Iwv6nw8U+7Yyl6gU BLHFTg2hYnLFJI4Xjg+AX1hHFVKmvl3VBHIsBv0oDcsQWXqY+NaFahT0lRPjYtrTa1v3tem/ JoFzZ4B0p27K+qQCF2R96hVvuEyjzBmdq2esyE6zIqftdo4MOJho8uctOiWbwNNq2U9pPWmu 4vXVFBYIGmpyNPYzRm0QPwARAQABwsF8BBgBCgAmAhsMFiEEm9B+DgxR+NWWd7dUG5NDfTtB YpsFAmA872oFCRRflLYACgkQG5NDfTtBYpvScw/9GrqBrVLuJoJ52qBBKUBDo4E+5fU1bjt0 Gv0nh/hNJuecuRY6aemU6HOPNc2t8QHMSvwbSF+Vp9ZkOvrM36yUOufctoqON+wXrliEY0J4 ksR89ZILRRAold9Mh0YDqEJc1HmuxYLJ7lnbLYH1oui8bLbMBM8S2Uo9RKqV2GROLi44enVt vdrDvo+CxKj2K+d4cleCNiz5qbTxPUW/cgkwG0lJc4I4sso7l4XMDKn95c7JtNsuzqKvhEVS oic5by3fbUnuI0cemeizF4QdtX2uQxrP7RwHFBd+YUia7zCcz0//rv6FZmAxWZGy5arNl6Vm lQqNo7/Poh8WWfRS+xegBxc6hBXahpyUKphAKYkah+m+I0QToCfnGKnPqyYIMDEHCS/RfqA5 t8F+O56+oyLBAeWX7XcmyM6TGeVfb+OZVMJnZzK0s2VYAuI0Rl87FBFYgULdgqKV7R7WHzwD uZwJCLykjad45hsWcOGk3OcaAGQS6NDlfhM6O9aYNwGL6tGt/6BkRikNOs7VDEa4/HlbaSJo 7FgndGw1kWmkeL6oQh7wBvYll2buKod4qYntmNKEicoHGU+x91Gcan8mCoqhJkbqrL7+nXG2 5Q/GS5M9RFWS+nYyJh+c3OcfKqVcZQNANItt7+ULzdNJuhvTRRdC3g9hmCEuNSr+CLMdnRBY fv0= In-Reply-To: <20240529-apol-ina2xx-fix-v1-2-77b4b382190f@axis.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 29/05/2024 08:07, Amna Waseem wrote: > > +static int ina2xx_set_alert_polarity(struct ina2xx_data *data, > + unsigned long val) > +{ > + int ret; > + > + if (val > INT_MAX || !(val == 0 || val == 1)) > + return -EINVAL; > + > + mutex_lock(&data->config_lock); Aren't you calling it before registering sysfs interface? Why do you need mutex? > + ret = regmap_update_bits(data->regmap, INA226_MASK_ENABLE, > + INA226_ALERT_POLARITY_MASK, > + INA226_SHIFT_ALERT_POLARITY(val)); > + > + mutex_unlock(&data->config_lock); > + return ret; > +} > + > /* > * Calibration register is set to the best value, which eliminates > * truncation errors on calculating current register in hardware. > @@ -659,6 +679,14 @@ static int ina2xx_probe(struct i2c_client *client) > if (ret) > return dev_err_probe(dev, ret, "failed to enable vs regulator\n"); > > + if (!of_property_read_u32(dev->of_node, "alert-polarity", &val)) { > + ret = ina2xx_set_alert_polarity(data, val); > + if (ret < 0) > + return dev_err_probe( > + dev, ret, > + "failed to set APOL bit of Enable/Mask register\n"); That's odd wrapping. Please follow Linux coding style and align these. Best regards, Krzysztof