Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp458574lqj; Sun, 2 Jun 2024 06:31:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUXs5+4RbOibXNpybI5yB0aR9SO4hZD1aVRr821MDW/kVRKM0nU/uqfBRTK6ZThpjdLLobyv8pcfQDGV6aZxaUcbE8+kwcln90Xyqtoxw== X-Google-Smtp-Source: AGHT+IHYYSaz1kIrqK5IXdZySB/3Bwq/ylWTnBixWUIW+geWK2JoO4QLQOEkHxXjP/1Lk8tjLrez X-Received: by 2002:a05:6a00:22cd:b0:6e5:43b5:953b with SMTP id d2e1a72fcca58-7024780448bmr7702256b3a.14.1717335094665; Sun, 02 Jun 2024 06:31:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717335094; cv=pass; d=google.com; s=arc-20160816; b=D5nteVcwf1eLynN8hI1AfCEa263l25F594/iIb5/DRvveE94aXF4nCMfVBcYU7C0P4 sNy+at2IyxClM8pQMxrzJbQ41ox4rt6lPdDazo85AKEif26vKxOtRfTqZ0cfcIhodBh9 KfbtxXilXLRNwR2t9XbpcwvsUwkhMUGKtCZTlrIokdoUgmHS0BHUbPe2H1GteBz2Z7Rv lLK3AY6778tv+4ByCy82WIIq+oM09b0xzHa6fwe9nP8k+sJtpln09Mx/8Ux6dovECFs7 hKCWizOe4YQzj420dFOJ0vOcjtRaxmVB0vN3UhzAbzeTZxvz9jC6j48RoXDTYfj5d41+ oj8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=aw7GLI+9I7VBlvi63Y1pykkMyYiljUt6ifUCdPNrVEM=; fh=Y4sGQ1+uardMqR0Joy5wArZSznaWuXYvm8eH+BpMR8U=; b=CKpuMmlTCfJWOL7L1rkhE4n7hN+/HqU8EsjLZsZBXlOksTdS151arlpeexx1R+BHZE mrRB8ae3Jn5ZefoVAybfAjxFtuOqTYDeACB2+2nNtQ5DapUKG8AR/WY0ZV/S4Ce2mY7T lgK6AdIchgWshiuHt9fLWTp+Bm7mcOrS9XTVz7t5S954+btfppoqUjNluK5NtrLudEBI GsjeZetvEYcSJfsvRdckYpcOP8P4JBbJwm2h9PcEo8UD+9RkG91+w1DhBQv9zamxpbyK KUP/XClL18eGwQGZlY+QQGxVk5LmjcmXk3IDzb92JoQlZB3XinEOlxinu8tr4teZbwYJ miGQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=unxCPKgf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-198256-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198256-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-70253c50e2asi3186952b3a.12.2024.06.02.06.31.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 06:31:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198256-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=unxCPKgf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-198256-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198256-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F342F282B29 for ; Sun, 2 Jun 2024 13:22:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE3C93D984; Sun, 2 Jun 2024 13:22:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="unxCPKgf" 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 ED4083BBC1; Sun, 2 Jun 2024 13:22:14 +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=1717334535; cv=none; b=YL+JyVlaZjjoMaUJ9UO0G2amu72VQrhJChaiVmXBfSoi+MCJ5E0SiMo3YTfVdD+HYYeEYsFfLp7uiVyLQ7gm6gALkOmWiiJqQWZA92cOS6cOryMzwI2bwgk95uEb5/tHXkA3vpiLsmAMsdbKk/0dK6IY824yBRSIO80SOCfFcoM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717334535; c=relaxed/simple; bh=oHVVffAxvtAhXS+j6pB4u46B0FyQhzmWOd8cOg7DKMg=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GQ87GQUbSBq0cIORf8dzP3C+SYUi6Sm91CKpUchtqFcDIhWpgNZ7VOHYwt1vGIbp+y+ZPjdltr6DmdbS6JrrP5948W8t/1csRE6voGJUwk+dMzyYcN6o8K3yr4uW/xwRk170ZvFECDPRNWAYcx6m73oehmWrKuc7F3J6GYXnDFg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=unxCPKgf; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFAB6C4AF07; Sun, 2 Jun 2024 13:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717334534; bh=oHVVffAxvtAhXS+j6pB4u46B0FyQhzmWOd8cOg7DKMg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=unxCPKgfvztHyfT67Up2/ga6P4UCg4RDWOrhEyStu8nPEYuLZyn8a1eWHaCeJr0J4 ehC4AsmE6wYgb1t9JNk4DRZIIfxdgqB1npHLJqhTcrWNJrKfnnvNwQTieb5q20PFXN OZmz+goOwpZBq5Mnm76b8BJIoAgr6S3ydN6f9t2H7zRa33F/o0mLZAPrTOoxk6nLPl dU3Ql7ytKClLR/HyFiidXseT4diIkr/yN8UUp2JRYThEd/xM89jHtXZd9a5hgTRJdJ nv/Kj5WvrTMaF5TxINb8G5/6Tq+Mrq7FYIqA6TjTx+txMG/y7yAjnU5awEw5cC9sM1 R7C+rvXCBHngA== Date: Sun, 2 Jun 2024 14:22:05 +0100 From: Jonathan Cameron To: Arthur Becker via B4 Relay Cc: arthur.becker@sentec.com, Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v3 1/2] iio: light: driver for Vishay VEML6040 Message-ID: <20240602142205.520c2635@jic23-huawei> In-Reply-To: <20240527-veml6040-v3-1-6f3bbfd42960@sentec.com> References: <20240527-veml6040-v3-0-6f3bbfd42960@sentec.com> <20240527-veml6040-v3-1-6f3bbfd42960@sentec.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.42; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Mon, 27 May 2024 17:12:08 +0200 Arthur Becker via B4 Relay wrote: > From: Arthur Becker > > Implements driver for the Vishay VEML6040 rgbw light sensor. > > Included functionality: setting the integration time and reading the raw > values for the four channels > > Not yet implemented: setting the measurements to 'Manual Force Mode' (Auto > measurements off, and adding a measurement trigger) > > Datasheet: https://www.vishay.com/docs/84276/veml6040.pdf > Signed-off-by: Arthur Becker Hi Arthur, A few really trivial things inline. I'd have just tidied them up whilst applying, but I think you are doing a v4 anyway to merge the bindings so I'll leave the requested tweaks to you. Jonathan > diff --git a/drivers/iio/light/veml6040.c b/drivers/iio/light/veml6040.c > new file mode 100644 > index 000000000000..2ea00d57c38b > --- /dev/null > +++ b/drivers/iio/light/veml6040.c > +static int veml6040_probe(struct i2c_client *client) > +{ > + struct device *dev = &client->dev; > + struct veml6040_data *data; > + struct iio_dev *indio_dev; > + struct regmap *regmap; > + int ret; > + > + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) > + return dev_err_probe(dev, -EOPNOTSUPP, > + "I2C adapter doesn't support plain I2C\n"); > + > + indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); > + if (!indio_dev) > + return dev_err_probe(dev, -ENOMEM, > + "IIO device allocation failed\n"); > + > + regmap = devm_regmap_init_i2c(client, &veml6040_regmap_config); > + if (IS_ERR(regmap)) > + return dev_err_probe(dev, PTR_ERR(regmap), > + "Regmap setup failed\n"); > + > + data = iio_priv(indio_dev); > + i2c_set_clientdata(client, indio_dev); I don't think this is used. If it isn't, don't set it. > + data->client = client; > + data->regmap = regmap; > + > + indio_dev->name = "veml6040"; > + indio_dev->info = &veml6040_info; > + indio_dev->channels = veml6040_channels; > + indio_dev->num_channels = ARRAY_SIZE(veml6040_channels); > + indio_dev->modes = INDIO_DIRECT_MODE; > + > + ret = devm_regulator_get_enable(dev, "vdd"); > + if (ret) > + return ret; > + > + int init_config = Generally we are still sticking to traditional C rules so keep the local variable definition at the top of the file. The only common exception is when cleanup.h functionality is involved and we want to ensure ordering by moving the variable definitions into the code. > + FIELD_PREP(VEML6040_CONF_IT_MSK, VEML6040_CONF_IT_40_MS) | > + FIELD_PREP(VEML6040_CONF_AF_MSK, 0) | > + FIELD_PREP(VEML6040_CONF_SD_MSK, 0); > + > + ret = regmap_write(regmap, VEML6040_CONF_REG, init_config); > + if (ret) > + return dev_err_probe(dev, ret, > + "Could not set initial config\n"); > + > + ret = devm_add_action_or_reset(dev, veml6040_shutdown_action, data); > + if (ret) > + return ret; > + > + return devm_iio_device_register(dev, indio_dev); > +} > + > +static struct i2c_driver veml6040_driver = { > + .probe = veml6040_probe, > + .id_table = veml6040_id_table, > + .driver = { > + .name = "veml6040", > + .of_match_table = veml6040_of_match, > + }, > +}; > + Trivial: Common practice is no new line here as the macro is very tightly coupled to the structure. > +module_i2c_driver(veml6040_driver); > + > +MODULE_DESCRIPTION("veml6040 RGBW light sensor driver"); > +MODULE_AUTHOR("Arthur Becker "); > +MODULE_LICENSE("GPL"); >