Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp33422465rwd; Sat, 8 Jul 2023 11:30:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlFWlMiuYeWl0x3rBnx2V2b072pCWibNqWPdkA930QeZ0hWiBDxFkz7wx1NzvpQPATcNROBC X-Received: by 2002:a05:6a20:918a:b0:10f:f672:6e88 with SMTP id v10-20020a056a20918a00b0010ff6726e88mr7220773pzd.4.1688841006179; Sat, 08 Jul 2023 11:30:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688841006; cv=none; d=google.com; s=arc-20160816; b=PaAhCL8fWKHQmbarNKGbLCXrvHLKv/Fecn1aht8g5e4Awjm7ZJi5frA7qRg3NdJS0R 1jBQey6wGq8K8nj8sI5Dj+8oymctO7PU141dAC91j7bFBQGo+KO5iMqnxLF+JQYlER8C eo3N9TuLI9an+BAjRqgksehfI0dvd7K8LJbYd4GidBfDI6+MNMc6vMlKoNeckwa88/Fz 20zLQ68MaT0OEpK1YxbH2FFXwT9DoRkjBH5FX7lj/iMEo7B9Sf4xE/gglF0HXG5nsysL FUt5e6trCn4fBNOQ80cSvgF9/OROqP97ksKxhWgk4l7CwS2WDNu9xSK4+q1iSJ9jfinb /m0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=tJCcwMe+WtcyS54uF9L4q2kWvdMezcX8ok88rgFYEg4=; fh=6A/yyIjJm4kp5YlbsOunyTQi+bLFloivqrjLm2ZCMvc=; b=oG/aFxOkpmnj8GMKdlxcWA2YZBYjqda9y3rFagAoPyAaczgRd7Kt7azibvQZCYNKBe vZnzTKHxdoc78Kpg3Jt7O1MeDWiDDDNeZWBurIsHUzIK7KQKa1jTq1YOfAX5zcsjhT95 cZ/mElSQnayEp0H6jyP10BXpZY7fsvfYcAWU3aBGnr8xZKVBt4B0B0EJ5pvNsCIc/gVz Ca2bC5vkiwgBib8aa/szSNQi9lvbpnweBoiaG+8SNGyxB2l4niLJrf3GTEA/JgEGI9hW EKAxevHg9ir29qAEj4OsSZonTi4oNRTZyNLwgzfPuomN2V/NOukgfDbZd6CZzncH6PD2 ecpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iFJdc0SC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y33-20020a634b21000000b0055bc1aaa7e0si5817487pga.618.2023.07.08.11.29.51; Sat, 08 Jul 2023 11:30:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iFJdc0SC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229816AbjGHQQb (ORCPT + 99 others); Sat, 8 Jul 2023 12:16:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjGHQQa (ORCPT ); Sat, 8 Jul 2023 12:16:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A75911BB; Sat, 8 Jul 2023 09:16:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 33D1460C0B; Sat, 8 Jul 2023 16:16:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5E0CC433C7; Sat, 8 Jul 2023 16:16:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688832988; bh=oSuDuGuXNiFSmzgo+7r+Wfg/zaVt4lj7wHdTOY12IYQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iFJdc0SCAG5/5WEv9NY0Dm0o3v4bmjq3fe7gylAotDyQ1jd0xg2keB+zK227HFIXQ CZmVq8tad6e8exD8foaFD8+Kak58zyPYpCDp6EDYcHtM4xfN2KUneyA78wjqlxsRqN iavvhxj399pzsFBzdYHJqKTD93XTYvM7/7pM+BvwJODfjNIORai6oLTsHkSwkfWKcS GKcDaepyr5WMlRf0znUFfiHNkO79gZksIDk755lTJgaCML71Wx+AWVRLsv6s2SfxAc XaSsT64U4j+Na7dW4IhClmG0QYY4CElgH5GgBlUD9yVGwS+HZwh33Xl/qO5dNsioMJ WzpwijtrdoD8Q== Date: Sat, 8 Jul 2023 17:16:21 +0100 From: Jonathan Cameron To: Matti Vaittinen Cc: Matti Vaittinen , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/3] iio: light: bu27008: add chip info Message-ID: <20230708171621.616fad8f@jic23-huawei> In-Reply-To: References: X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 7 Jul 2023 14:23:03 +0300 Matti Vaittinen wrote: > The ROHM BU27010 RGB + flickering sensor is in many regards similar to > the BU27008. Prepare for adding support for BU27010 by allowing > chip-specific properties to be brought from the of_device_id data. > > Signed-off-by: Matti Vaittinen > One trivial comment. The ffs stuff is a pain. There have been a few goes at defining standard functions for doing that but I don' think anything ever landed upstream. > --- > Revision history: > v1 => v2: > - Move all generic refactoring from next patch to this one so that the > next one will only contain the BU27010 specific additions. > - reorder bu27008 chip-data assignments to match the struct member > placement > - Cleanup > --- > drivers/iio/light/rohm-bu27008.c | 323 ++++++++++++++++++++----------- > 1 file changed, 208 insertions(+), 115 deletions(-) > > diff --git a/drivers/iio/light/rohm-bu27008.c b/drivers/iio/light/rohm-bu27008.c > index b50bf8973d9a..08e2b1194bf4 100644 > --- a/drivers/iio/light/rohm-bu27008.c > +++ b/drivers/iio/light/rohm-bu27008.c > @@ -211,7 +211,35 @@ static const struct iio_chan_spec bu27008_channels[] = { > @@ -993,14 +1086,14 @@ static int bu27008_probe(struct i2c_client *i2c) > data->dev = dev; > data->irq = i2c->irq; > > - idev->channels = bu27008_channels; > + idev->channels = &bu27008_channels[0]; Why? When setting a pointer to the 'whole' array I tend to prefer the original. Can't see a reason why this should be changed to the second one. > idev->num_channels = ARRAY_SIZE(bu27008_channels); > - idev->name = "bu27008"; > + idev->name = data->cd->name; > idev->info = &bu27008_info; > idev->modes = INDIO_DIRECT_MODE; > idev->available_scan_masks = bu27008_scan_masks; > > - ret = bu27008_chip_init(data); > + ret = data->cd->chip_init(data); > if (ret) > return ret; > > @@ -1021,7 +1114,7 @@ static int bu27008_probe(struct i2c_client *i2c) > } > > static const struct of_device_id bu27008_of_match[] = { > - { .compatible = "rohm,bu27008" }, > + { .compatible = "rohm,bu27008", .data = &bu27008_chip }, > { } > }; > MODULE_DEVICE_TABLE(of, bu27008_of_match);