Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp989614rbb; Sun, 25 Feb 2024 13:53:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX8W8kBk8ypShRzabo2MK00ShUL/XBD0Qa8fil4JXkL51op1eKg/uZz6y3wh1fWIGs+EUjCDOfv7xmrpp4t7OTHPJLyXYGszkMP3/qrHQ== X-Google-Smtp-Source: AGHT+IGE6AjyEVdZ+C/mgzgLeUU7MFxhdbZzbGnCwMjGszHVe7wnzeBjdWD9Ghul5T52mL33fWXi X-Received: by 2002:a0c:e1cf:0:b0:68f:52b3:57ad with SMTP id v15-20020a0ce1cf000000b0068f52b357admr5829100qvl.46.1708898001511; Sun, 25 Feb 2024 13:53:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708898001; cv=pass; d=google.com; s=arc-20160816; b=kfYbVz20Nehg17HjRxj3wjgECdk9UORQIofxHsgQm8njHTsiB0uzsjS2vwxRpc8GOi zcuPATYLbPBTxWGmvDVSO9NJKY1lkiZqdD08hG+uIzIb5ZV1Ru7E0YmrV23liXVq+gCn Q3tA6mkrUqqZNZvjiGTJzWN953DJBYQTC3fwbhrFtNykg0TfrGmGxARResHbQlMnx53D //W3bFBM1EO1lyINLQyqnPeXvlinWHBILMOuKKV99eH4XC/nCVO6KQ9PNMwoSx3MtzTz FruB7xtgIxx6P6/SEwpaPcBTif52WGk2Qk1ezLjMPNyMAXK7yG3j6vkL7ZB4RYHhSnpT lqwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=f2lWRfoRch8p0TMVIKMDa6faIvB4hys9OMUr2ndcYr0=; fh=Xabip+q0aeqZVrzZu5QJfFifu1ZJsRhJ9N3WoD4+gEg=; b=ClDLJ+xZin+inamavu1VjdJ42AJUwZBUMpvHiRJIPw9jX44YPgAX1SZ9BzXhc8VhX2 xdZY2bAMN13zGQK2AY63VmH2L8KHER5iKEYM6IKeFO52gAajOGkDhS/FPsNrfL9IxwHp +zGeai+noKToqjDCe01KlFPCk50uMnxidaF2mUuT1Cn+NpcpN5s1my7x2rQDTJjlqYYi cACRw0bQrY/mcoUa6CWvGzH6gf7P22O3V5eMm19f7xrsMZLuVOecWZXL+9OzyvgIsJzH WEMz0sZEbK32kIUeyojZWv/6d1stiM12cuxmyOF2LZ9uYZtrSpHLMxSqTN9JlLQFHf6X e/gA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=DV33ijJt; arc=pass (i=1 spf=pass spfdomain=xff.cz dkim=pass dkdomain=xff.cz dmarc=pass fromdomain=xff.cz); spf=pass (google.com: domain of linux-kernel+bounces-80317-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80317-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i12-20020ad45c6c000000b0068fe19a8a87si3824895qvh.206.2024.02.25.13.53.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 13:53:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80317-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=@xff.cz header.s=mail header.b=DV33ijJt; arc=pass (i=1 spf=pass spfdomain=xff.cz dkim=pass dkdomain=xff.cz dmarc=pass fromdomain=xff.cz); spf=pass (google.com: domain of linux-kernel+bounces-80317-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80317-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz 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 4749D1C2090F for ; Sun, 25 Feb 2024 21:53:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E33261B977; Sun, 25 Feb 2024 21:53:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b="DV33ijJt" Received: from vps.xff.cz (vps.xff.cz [195.181.215.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 177B81BC26; Sun, 25 Feb 2024 21:53:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.181.215.36 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708897991; cv=none; b=BqwQjcdYmkBAM9ma2EAb38v/mG1mBiSYhbmorADlC+CdBypwfZkjntMr6Ka94Heh+wHzgUl1xIX8oDKxPfVx/ybryPxzvBQohYMxOKcMyjbRVZACKajiQO2FyITgZ8lB8gEXwv2Ii9PY+abuA+PCaBNjWP6P4TNnQJ3FE9MniaA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708897991; c=relaxed/simple; bh=c7qVMzP3hjDjRYr9GI+qimmAMxJsHCBlkxOXyxRGfdM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mZzsa6vUykvfM+jk2x7WR/JPJwzX7iQ40apkgh51qBLuJzIqh/2Q2JRzgzv92HI17xRvW7yvf3TYmn8Wbw5NUMWLmNgaqdDyJJ0CfFtAOU1hVart2Us4eaDSjqPgIMtVvm0MBSHFiftis0iMe4uKb7ACNF9o3jC9qIQfvI84TIc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xff.cz; spf=pass smtp.mailfrom=xff.cz; dkim=pass (1024-bit key) header.d=xff.cz header.i=@xff.cz header.b=DV33ijJt; arc=none smtp.client-ip=195.181.215.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xff.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xff.cz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xff.cz; s=mail; t=1708897979; bh=c7qVMzP3hjDjRYr9GI+qimmAMxJsHCBlkxOXyxRGfdM=; h=Date:From:To:Cc:Subject:X-My-GPG-KeyId:References:From; b=DV33ijJtLijd5NdSy6eThWEcxekzatlBDPxUL26zXZCKhZgfaJIVqGHORR06AUH60 02nH5El2hc/Rf1V5O1aVlFYmT2FNxcA9deWj3Cwdd29G2OtywSvtHSu28QaNzNh+Rz FVn/I0O9GcuOo6ypcHwTUBuEQQIU7gejn+meqUdo= Date: Sun, 25 Feb 2024 22:52:59 +0100 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: Jonathan Cameron Cc: linux-kernel@vger.kernel.org, Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andrey Skvortsov , Icenowy Zheng , Dalton Durst , Shoji Keita , linux-iio@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v4 3/4] iio: magnetometer: add a driver for Voltafield AF8133J magnetometer Message-ID: Mail-Followup-To: =?utf-8?Q?Ond=C5=99ej?= Jirman , Jonathan Cameron , linux-kernel@vger.kernel.org, Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andrey Skvortsov , Icenowy Zheng , Dalton Durst , Shoji Keita , linux-iio@vger.kernel.org, devicetree@vger.kernel.org X-My-GPG-KeyId: EBFBDDE11FB918D44D1F56C1F9F0A873BE9777ED References: <20240222011341.3232645-1-megi@xff.cz> <20240222011341.3232645-4-megi@xff.cz> <20240225120700.2a0da3f6@jic23-huawei> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240225120700.2a0da3f6@jic23-huawei> Hello Jonathan, On Sun, Feb 25, 2024 at 12:07:00PM +0000, Jonathan Cameron wrote: > On Thu, 22 Feb 2024 02:13:37 +0100 > Ondřej Jirman wrote: > > > From: Icenowy Zheng > > > > AF8133J is a simple I2C-connected magnetometer, without interrupts. > > > > Add a simple IIO driver for it. > > > > Co-developed-by: Icenowy Zheng > > Signed-off-by: Icenowy Zheng > Check patch correct moaned that Icenowy is the author (from:) > so doesn't need a co-developed. > > > Signed-off-by: Dalton Durst > > Signed-off-by: Shoji Keita > > Co-developed-by: Ondrej Jirman > > Signed-off-by: Ondrej Jirman > > Reviewed-by: Andrey Skvortsov > > Tested-by: Andrey Skvortsov > > Hi. > > A few really minor things noticed during a final review. > I'll tweak them whilst applying. Diff is Thank you very much for finishing touches. > > +static int af8133j_product_check(struct af8133j_data *data) > > +{ > > + struct device *dev = &data->client->dev; > > + unsigned int val; > > + int ret; > > + > > + ret = regmap_read(data->regmap, AF8133J_REG_PCODE, &val); > > + if (ret) { > > + dev_err(dev, "Error reading product code (%d)\n", ret); > > + return ret; > > + } > > + > > + if (val != AF8133J_REG_PCODE_VAL) { > > + dev_err(dev, "Invalid product code (0x%02x)\n", val); > > + return -EINVAL; > > This should be warn only and we should carry on regardless. The reason > behind this is to support fallback compatible values in DT to potentially enable > a newer device to be supported on an older kernel. > > Many IIO drivers do this wrong as my understanding on what counted on > 'compatible' used to be different. Long discussions on this with the DT > maintainers led me to accept that letting ID checks fail was fine, but > that a message was appropriate. Often a fail here actually means no device. > We have some exceptions to this rule for devices where we know the same > FW ids are in use in the wild for devices supported by different Linux > drivers - but those are thankfully rare! Makes sense. If newer device variant has the same register meanings, but just a different ID register, this way it can be supported without driver modifications. I'll keep it in mind when doing ID checks in other drivers. Thanks for all your detailed notes during the review. I learned a few new subtleties. Kind regards, o. > > + } > > + > > + return 0; > > +} > > + > } > > > +static const int af8133j_scales[][2] = { > > + [0] = { 0, 366210 }, // 12 gauss > > + [1] = { 0, 671386 }, // 22 gauss > Trivial so I'll fix it up: IIO comments are /* */ > not C++ style (with exception of the SPDX stuff that needs to be). > > +}; > > >