From nobody Thu Nov 28 17:45:31 2024 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 82F4B2AE90; Sun, 29 Sep 2024 20:38:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727642335; cv=none; b=s56i0ZY2Zz3WKCnfteJ29nPr5q85ZTls9PRSVdRPj6h0XEa4COddbyxmM+QlHCdxAvcXSRFZ+m3GY4UN+HGhVxZgnA0Z/X3jIK6WONP8Q46TM3HA77hmxe1FVKcDP6g/SddycoBQ/8bjxlHILk8Y52PQ3riI/k7gnlvnC501jig= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727642335; c=relaxed/simple; bh=PS84KGlvp7AflQAyoQJs6pFrBW7fmCrzJpt/+luR1Gc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uagviKgPIkRgoOrZ4bVzzdQ0tTOe/n7MaRoXWBg/DkgLWiR5mYGvpvoTMZThgxEUlFtRAzhvlQDJuzqxlEzx714jfPTliUZ1lqUJ8wCbxRwZUUZBhYuCZMxPZeE6H2pHtQPErFKfkQPkkbxyBTyCkSISp12YcWp8Jn6Rp0pMDws= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JBx1pM5p; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JBx1pM5p" Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a8d446adf6eso636921066b.2; Sun, 29 Sep 2024 13:38:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727642332; x=1728247132; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=yuaIft20Ql2rSmGWWdOJTX9VQf3hfQ2B1fumcjgC0xw=; b=JBx1pM5plOkIuDjWUpw57yHk4e4uCsbsDm14HijJ6/cujs53KRYWNtqIepkRkJ6x8P vyONnxh8kt+6DXCNFg5HZMXPCyaxExlEZPO9jq4ES0FeqC1XvAmGAm80mhwIGfCOE013 QDLAo9UmXlHg8STPkh731Fd3EFs2EPuhR0lvHpESryBZz7N23tvKeJe4wUp77YRG4pCT DVpmZQb+PZnPfdNjMuUIIt4x022VcoPiphFj7WdsfbcO+cGTCmu8tvPWcm2aO1ZEh9hi HQFGTVvq2AVrQVfmRmqhonMhRKk2PnTP3jDiNV77NexnXHTD3fIyO4syj0MmborOWVpi KJAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727642332; x=1728247132; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yuaIft20Ql2rSmGWWdOJTX9VQf3hfQ2B1fumcjgC0xw=; b=ARQUrcIco81SB5mHaIhPdRnDBGBQVbtqfvsQ1zNAen0gdCTMB+SyyiwY5t+WsM3gQv DaNtdYeV68o5ZOHIxIDpGBvCdIzvD21rkhOGMApQM37H37MXBf1aW0+V4PGKaOjkcss5 aTpqOcZSFClT/Luzwdos7GoXghLj/HGiFg/k/KdWjcEy+qJJe534RW32WxklvpOW0i8A 8wWpFxg40ntdaVidwX6jTFNQLPsQefwCD4pGDDaXQYKzSENT/GZ8XXMzh+L2xf6i+LLT 6xCGkRdtQki9Ua6bYjGQhWKBxxSlRzvOkS4AShiXw1QiSCba1W3cgXvw3/WJnL8LmFvK w6gg== X-Forwarded-Encrypted: i=1; AJvYcCUF0XGSlH1SwBxQMrDw2V5Dc1Pq/zJGOYdETtzHJWyIVSoVuu1/PTIe+Y4AqkafoS6pGBl6hZJLSUBFzL2C@vger.kernel.org, AJvYcCVAtPf2vSna9LtBVyatC0iP+Dl1996sUsMj9TlIsIdHShb662av5A1p6qHxKDPOm06sqPbt/lSfFlBn@vger.kernel.org X-Gm-Message-State: AOJu0YxyNtrhMBqaMZR9HAlzCGbFVVN7SuToVAMdks7evD8YVyGibuNW 9JRSbh6FmY8ij0uRmu5vknGiMzEABojnIdxLsDmw6IOQZBx3Awm9kCmKpsqo X-Google-Smtp-Source: AGHT+IEAzmAWslIqpsVj/X4D0eCH8cXZKZi4oo5mO/bkyY01gkyzuLCx3QU6TfHDPtKAj/2vgYxMYg== X-Received: by 2002:a17:906:d553:b0:a8a:87d5:2f5e with SMTP id a640c23a62f3a-a93c492a596mr1269147166b.34.1727642331683; Sun, 29 Sep 2024 13:38:51 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-e2c0-9a60-64a8-717a.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:e2c0:9a60:64a8:717a]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c8824051c2sm3487985a12.19.2024.09.29.13.38.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Sep 2024 13:38:50 -0700 (PDT) From: Javier Carrasco Date: Sun, 29 Sep 2024 22:38:46 +0200 Subject: [PATCH 1/7] iio: light: veml6070: add action for i2c_unregister_device 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-Transfer-Encoding: quoted-printable Message-Id: <20240929-veml6070-cleanup-v1-1-a9350341a646@gmail.com> References: <20240929-veml6070-cleanup-v1-0-a9350341a646@gmail.com> In-Reply-To: <20240929-veml6070-cleanup-v1-0-a9350341a646@gmail.com> To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1727642327; l=1726; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=PS84KGlvp7AflQAyoQJs6pFrBW7fmCrzJpt/+luR1Gc=; b=kadRFgaTHFj/1zfh5zQhsWePXmTaBiCh/wGWOH2YFZbiM9NZJ5AiwE5TB/OUnnTp0HxzqLLSh JZsgRMPqMCoCtMK8RKx8MEgUiSJcCbZfy9XP+AV3RyaGdqiBzK+1c5W X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Simplify the code by adding an action to call i2c_unregister_device(), which removes the need for a 'fail' label, gotos to it, and an explicit call in veml6070_remove(). Signed-off-by: Javier Carrasco --- drivers/iio/light/veml6070.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/iio/light/veml6070.c b/drivers/iio/light/veml6070.c index f8321d346d77..3c476b6f6122 100644 --- a/drivers/iio/light/veml6070.c +++ b/drivers/iio/light/veml6070.c @@ -135,6 +135,13 @@ static const struct iio_info veml6070_info =3D { .read_raw =3D veml6070_read_raw, }; =20 +static void veml6070_i2c_unreg(void *p) +{ + struct veml6070_data *data =3D p; + + i2c_unregister_device(data->client2); +} + static int veml6070_probe(struct i2c_client *client) { struct veml6070_data *data; @@ -166,17 +173,13 @@ static int veml6070_probe(struct i2c_client *client) VEML6070_COMMAND_SD; ret =3D i2c_smbus_write_byte(data->client1, data->config); if (ret < 0) - goto fail; + return ret; =20 - ret =3D iio_device_register(indio_dev); + ret =3D devm_add_action_or_reset(&client->dev, veml6070_i2c_unreg, data); if (ret < 0) - goto fail; + return ret; =20 - return ret; - -fail: - i2c_unregister_device(data->client2); - return ret; + return iio_device_register(indio_dev); } =20 static void veml6070_remove(struct i2c_client *client) @@ -185,7 +188,6 @@ static void veml6070_remove(struct i2c_client *client) struct veml6070_data *data =3D iio_priv(indio_dev); =20 iio_device_unregister(indio_dev); - i2c_unregister_device(data->client2); } =20 static const struct i2c_device_id veml6070_id[] =3D { --=20 2.43.0 From nobody Thu Nov 28 17:45:31 2024 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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 A0A9817A922; Sun, 29 Sep 2024 20:38:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727642337; cv=none; b=Pv1nHPU0kn+/gxGh8AcoLkqkHXkrqRpqew0hLAA/s/Pg8CTjR/hIvKgPY8VyV8KXVMMptwmF9VdH6sSJcqZQOmURJfSAK3gI536wkUkhe5rFiWKMrv8LODzIRpA3/07MzFAiC1NEt96+Dek8SIYysM68ddYIrARp0hUpCSaYX9o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727642337; c=relaxed/simple; bh=jIBsAq1qDGDYHr2IDSUS9jTUCSQchvkFih2N04M1W2o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pITiYqU8wtGsqt4rPAlSplaeR7kt10wBf0Y7pRv4NYh41Z5Dda6qtPhFPhnfi1lUHdX8BL5njD6XJXWqrXtTI4cEjpwVfyusG3BoBS64cvZFSYTx9EOhtq+udLZHL1Uj5UB2VPnS5fN5BVOhBL/pmbcDjzhNAIq+1qT2/tkJ+dg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WlMcTy2A; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WlMcTy2A" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a8d43657255so589909866b.0; Sun, 29 Sep 2024 13:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727642334; x=1728247134; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=YM6JVtUjqMJf6niC9kqfqAofxw0iLOFDnfwbGtgaJq4=; b=WlMcTy2AyHdyvWlN601K9S2UM/hxHeNb8fwCZuqI8TmNLtfrjrfJcqAwO8zK++SriK h0oGMuXm/GRipG22HXi1Acqyl4Hha9nDmGNuH8+Zqxb7UMh/7gEwh5RqHA+HgrF8cxEp AaXq/svIM40OKQTskmbNVoOq9RX3djmKoYwCYw4fY2rSSTRBxWixfm+0JNdlCq/RsNTf 124WAbWmqd5WdmeZoXtmiYtrGZksb51KscavSreG2UoAEDtaCyJkjCDTDy7ur/wKtCcV +Be71Qm1Hvi+9VexAZf4P9eIaWPtKEt6SxWbS/zaSbDjOlMqN0Zm5cUQzxwIR1z1cmEh uPAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727642334; x=1728247134; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YM6JVtUjqMJf6niC9kqfqAofxw0iLOFDnfwbGtgaJq4=; b=A7Rup9m4EEYphlk0SWpE0sxk4/AFM1q1H89zjshygiwGqk+fj2UyMY2H2gWACPOjNH hzhBTY/tUW6XZ3foWhlEZxYJlfzi9SoBbRRCqmiRgYYFMuk/PuYkDArJLz7Uvfe18pAy k0GGrPXtlMEAqa7KyuzlBAxZaC6dD88qneyMRuOtT4p1d/BQqbaclNJGPEWACLOjQQd5 ogeraMxA75+z68PU6wKqX4ZOwu8oXe1w1KvDMG/8QZIlsLdNP9xkDpIdszHXAGapDJ1g v6iYWSFU8llfXwKCCY6sZ1Q55LAw0UUbwPESGTljKl501yLQBSOZoxxHLkQna4yCjKIT JbRg== X-Forwarded-Encrypted: i=1; AJvYcCWF593vMPEy696RwusJEiMihiE8ay3dncBWHRTDJvvs2LLQzv2JB9t+rjlD7Y4kC0aWotUDkIseG9X1+ffB@vger.kernel.org, AJvYcCWdanSpuEWv8GMawr8AyM0MmgBieydq3FgbfGEGsdkBSgV+l8iLHKO6iCp5uD5VZe54pfEJU49EoDVH@vger.kernel.org X-Gm-Message-State: AOJu0YyT8Li98LrS2iV+38PrjFz4n/GrM95jJ08Z8ETw8TnaeUkvpsEb iWOo2OOXUZ98lo1PVpe4XmBy4uWVDiJr4Y8JWrTfbhs/n2MQSoiDFh1vVzFV X-Google-Smtp-Source: AGHT+IGUdBzdwVetrQsZC32m66yyO4n5IFwJ7k9q8iloEFfQQwyzHCdbdnQXlGKmeXbKTrlESR3NBQ== X-Received: by 2002:a17:906:db05:b0:a86:812a:d2ca with SMTP id a640c23a62f3a-a93c490a0abmr1041266266b.25.1727642333791; Sun, 29 Sep 2024 13:38:53 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-e2c0-9a60-64a8-717a.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:e2c0:9a60:64a8:717a]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c8824051c2sm3487985a12.19.2024.09.29.13.38.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Sep 2024 13:38:52 -0700 (PDT) From: Javier Carrasco Date: Sun, 29 Sep 2024 22:38:47 +0200 Subject: [PATCH 2/7] iio: light: veml6070: use guard to handle mutex 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-Transfer-Encoding: quoted-printable Message-Id: <20240929-veml6070-cleanup-v1-2-a9350341a646@gmail.com> References: <20240929-veml6070-cleanup-v1-0-a9350341a646@gmail.com> In-Reply-To: <20240929-veml6070-cleanup-v1-0-a9350341a646@gmail.com> To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1727642327; l=1437; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=jIBsAq1qDGDYHr2IDSUS9jTUCSQchvkFih2N04M1W2o=; b=8JJmmQt/55MjwbZ5YMqbgYGx9gXI3SOo5rStmwtu7uKzIGY/CblIaHkCwjnRMKFIjiXe1L1uN RduH9JdIEmJD3UeypPO1R4tj3VYZjZxiQBgyqHz4wvVtDxPMNKQIUJ+ X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Simplify the mutext handling by using a guard to automate the mutex unlocking. Signed-off-by: Javier Carrasco --- drivers/iio/light/veml6070.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/iio/light/veml6070.c b/drivers/iio/light/veml6070.c index 3c476b6f6122..945ef58beead 100644 --- a/drivers/iio/light/veml6070.c +++ b/drivers/iio/light/veml6070.c @@ -42,36 +42,36 @@ static int veml6070_read(struct veml6070_data *data) int ret; u8 msb, lsb; =20 - mutex_lock(&data->lock); + guard(mutex)(&data->lock); =20 /* disable shutdown */ ret =3D i2c_smbus_write_byte(data->client1, data->config & ~VEML6070_COMMAND_SD); if (ret < 0) - goto out; + return ret; =20 msleep(125 + 10); /* measurement takes up to 125 ms for IT 1x */ =20 ret =3D i2c_smbus_read_byte(data->client2); /* read MSB, address 0x39 */ if (ret < 0) - goto out; + return ret; + msb =3D ret; =20 ret =3D i2c_smbus_read_byte(data->client1); /* read LSB, address 0x38 */ if (ret < 0) - goto out; + return ret; + lsb =3D ret; =20 /* shutdown again */ ret =3D i2c_smbus_write_byte(data->client1, data->config); if (ret < 0) - goto out; + return ret; =20 ret =3D (msb << 8) | lsb; =20 -out: - mutex_unlock(&data->lock); - return ret; + return 0; } =20 static const struct iio_chan_spec veml6070_channels[] =3D { --=20 2.43.0 From nobody Thu Nov 28 17:45:31 2024 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (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 422D017CA17; Sun, 29 Sep 2024 20:38:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727642338; cv=none; b=U7fEcd6eQdIboe711rzVFj4cUdcivmsiY3NlygwxdCaEZYXfs1Sl2xD3Mz4IXedGYieTuNIhpoY0010tK4VyxpGY2uHF8Ql99GLzGwtOJOe7DP4lheFdQ+K87DAEtavW57xuKpua9CX0qmOLBMmoF3n3Oi+Tz9cfa+FH9uhXR/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727642338; c=relaxed/simple; bh=xf9Ckb52b6K2cFHLA69xB+QNNC6/b5yI9CCbBoPMqn4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SUj1+cB9a7feVSe/wU5OdLxWIIxlCzlAQ8svR7amRng2Jj1DmL+Wb4+E2oZawABIgEAzMkRXCzJfKuHQV+UD1GUQl40WNbA/Nh1bMOJrngjbPzrAnBdhR7q3kE8AR6TXfAn35dHBCL3he3Hspfxt0QPSIOknCLEmy6CfVKQj6ck= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WueAZlfI; arc=none smtp.client-ip=209.85.208.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WueAZlfI" Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-5c88b5c375fso1867774a12.3; Sun, 29 Sep 2024 13:38:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727642335; x=1728247135; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=8JYGK3JMqfTPdWjEdWDCZFqtYoOKBeT8G6aSVaHOunY=; b=WueAZlfICC6xHtfd+OS2ExXEanq3F3VOH/GPtDddoqqufr9Y2sT8JRBpxTnNHWtd9/ jX12/DeEdltIPXE0vo5LRzl5KExdtUP4YTiwY79g6OlqvboT8QZswdQbbo7hEw/XMkD0 8IDtFp64wtVBAdC699vQz1rIkfsr0FkBcmDPtDI9uYFSaFYUAaUKM4I3L+mXBvDZJX4Z LL/HYrpwgVvHFY+YZcfWVAMgPyCPKbHGwMDwr0AGTY/MKX1YmYgUqHqv7ZLxM2IWRO7J Z8s4we4oiVfjamv2zNNxrt6RXms7ST/NzJC6pciIQvcyb1uUd8vWhmH/GQMhnHekgN/w AVxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727642335; x=1728247135; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8JYGK3JMqfTPdWjEdWDCZFqtYoOKBeT8G6aSVaHOunY=; b=fpHBmmsVcWoKYwmCDE1dc5xXjJqBGWbk6774zB3ABY1mxqj0YMmeZvdJwT4k8kSE48 lfgaJJZ9DwopiRlHlIhOStzlZ7ph7LQiXdmMp1uVTlIfnKCvdsOx45eKlLT1KHFpN4PE stSxZQQHczyPxGoBtzC+05DKcDccsnqkvlEhh/UMVEkJsBns5LlkzB8We+a+WeguUh2I iiEFNVHSQ+XBCP4cNswjTzZKpiw3+yK0fs1JY/I4AIjkFYRGTruIcKcjGK0Wu99iyZZp Owcga/v6736bkwUiwDrfcnhLy4OTBwWKRCyUkeq5P/t/KrQ65H/AB6Saqd23ISD7jhJm z6Aw== X-Forwarded-Encrypted: i=1; AJvYcCULbeDHqjFdOKAqK+A2G85B5nHljK5jWWukbxJbKrE2WryTOj3MVBn/FPxm94MNaI8flEwm4NHrH/LHrg7Z@vger.kernel.org, AJvYcCV2vspE2lZGgieAO2ROMOCYQkVH2V3HKLDNzr10E4wh9WLFWioPdvQmn4WGayenga/qWGMAWRoQv36t@vger.kernel.org X-Gm-Message-State: AOJu0YwM9WqtGwTAqHiYg8Wj0mPLWwT/w9Pt3Whfo6nh74XtxEiLZ2ap DvYHYUDFw2cVc8I0moV7o+asKfWcolju7JnyN1opLgZ3zrRLVQoz X-Google-Smtp-Source: AGHT+IEhzqMMHaiaG0NLtL0Y2+VDkzF834cXcGjhJEamrAkNlgYdKPmVce0ZKlegu3N5ED7iW4Npmg== X-Received: by 2002:a05:6402:27d2:b0:5c8:9406:535b with SMTP id 4fb4d7f45d1cf-5c89406540cmr2986927a12.18.1727642335477; Sun, 29 Sep 2024 13:38:55 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-e2c0-9a60-64a8-717a.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:e2c0:9a60:64a8:717a]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c8824051c2sm3487985a12.19.2024.09.29.13.38.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Sep 2024 13:38:55 -0700 (PDT) From: Javier Carrasco Date: Sun, 29 Sep 2024 22:38:48 +0200 Subject: [PATCH 3/7] iio: light: veml6070: use device managed iio_device_register 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-Transfer-Encoding: quoted-printable Message-Id: <20240929-veml6070-cleanup-v1-3-a9350341a646@gmail.com> References: <20240929-veml6070-cleanup-v1-0-a9350341a646@gmail.com> In-Reply-To: <20240929-veml6070-cleanup-v1-0-a9350341a646@gmail.com> To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1727642327; l=1211; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=xf9Ckb52b6K2cFHLA69xB+QNNC6/b5yI9CCbBoPMqn4=; b=6nCj+b7TpNO6MD517iTpiGnn30cxhTKIpqGAIGKziZxaWtvLAcRoWuqIBe2Aun2wGW4w+r4gm MlXUKqR5hD9DFyoUm2DAoduRK7djqk46x1KtVPAKgAGspA18S81bZcL X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Simplify the code by using devm_iio_device_register(), which removes the need for a 'remove' function, as there are no more actions to take. Signed-off-by: Javier Carrasco --- drivers/iio/light/veml6070.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/iio/light/veml6070.c b/drivers/iio/light/veml6070.c index 945ef58beead..d15caebdc959 100644 --- a/drivers/iio/light/veml6070.c +++ b/drivers/iio/light/veml6070.c @@ -179,15 +179,7 @@ static int veml6070_probe(struct i2c_client *client) if (ret < 0) return ret; =20 - return iio_device_register(indio_dev); -} - -static void veml6070_remove(struct i2c_client *client) -{ - struct iio_dev *indio_dev =3D i2c_get_clientdata(client); - struct veml6070_data *data =3D iio_priv(indio_dev); - - iio_device_unregister(indio_dev); + return devm_iio_device_register(&client->dev, indio_dev); } =20 static const struct i2c_device_id veml6070_id[] =3D { @@ -201,7 +193,6 @@ static struct i2c_driver veml6070_driver =3D { .name =3D VEML6070_DRV_NAME, }, .probe =3D veml6070_probe, - .remove =3D veml6070_remove, .id_table =3D veml6070_id, }; =20 --=20 2.43.0 From nobody Thu Nov 28 17:45:31 2024 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (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 B7E807DA8C; Sun, 29 Sep 2024 20:38:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727642341; cv=none; b=KBVW2TUeo9FjHSFnUG3oR3+wQLTAnZQVp9hNsyJwW+rx1Om8lZxzBmnqoJX0fav6Cg7/TR5KCgn3pxzKB4pObHcX1mnMyRwcV0ayXwmB2exRHVBbgzQaHpK8R+eiw3uq42pZn6DMQxCsgRnFgQcKcnDlyDqHEVChxtNGLCpAbv0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727642341; c=relaxed/simple; bh=f9tArTOelwRcZuYp5DRYRxrU8hSv0bj1O9hFv/wqYb4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hnjGtCyAyVvgOeNoZbdhU7xzyRixQu/Q1Xqi9RYh30d8WSCwYSmjGZAX/+5AwXGAYpi9IADysyUN1ft7hb5/+KGBk82QCQdvaD9uhDcpXpZNttTNpqheNGsAJeszOGGf0Ay3kI/OMNj+p4vmJsMJwr7j3Untyn/o+VXlZakvQ5o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fLl9eqnm; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fLl9eqnm" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-5c896b9b3e1so756400a12.2; Sun, 29 Sep 2024 13:38:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727642338; x=1728247138; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=zoqPx2xLt4s4Crl4T/xJ+0dSJqo4z84sx5wy+wejSF4=; b=fLl9eqnmwFnJk3uXPs7rTHzw+3IzYK0nP9FUwhJndq+qtcxB1IFOR4QnvqKNxGz033 qvuqecSAlkVvLBmp78Oweop4RUlzdkWS2BRpbZiEYjjdepIaaedALOXusZY35xcLSTvC NfRLTIEKwXVJhfZFlTP+uipenRLyEVe6W/VP1VqN0y0Xhih1nAEbcFRSiVFUBfG6Z096 YikIENvieJcOv0G3fPpNoy3kHSHOIAt2tKTT9NKz1LXQaPPrtcOYriJeZOV8eiEHIUug i70HWk1P4qkyGCRkM7a2ry9ZtwCg30u7EFXcJg//MAsOmkPgN8mMf+tuXGoa65dKCxiz 8DdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727642338; x=1728247138; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zoqPx2xLt4s4Crl4T/xJ+0dSJqo4z84sx5wy+wejSF4=; b=EkDHGsWWom4omTrD907+FKF+lBgvQ5fPA/Mj2DJpz72uvZscqsEDO7EWbsnaxyObop BelO6zIaEyAK22ytuqz0nOrAzhiXy6/kD4VR0TDmEJlWyQmVE5aTOx0SHIggBctNtO9r x5/BSTWeNb1NzskFhaSaJjSOqA5tdD1R3hRQGrN5tzv73xSpS4l7/+fyAoCxq27gqT53 pAmCc/S5krdB8FM5M+7yX6cPclSqVssDaMWVAafdvsB1Ksq2mDPUDgIakL6kglmtAscs EEk20Rnz9m4F1vwzpAhN1Ac6KTQB7/K8FyaLjA0mo+6F3nl2ICrfNDr2ZGfCm5QJF9nc fV3w== X-Forwarded-Encrypted: i=1; AJvYcCV7looa8bUBoDDI40Cmw+8Qw6w7EwI8cRMkvvxrRLgYeSxs5srFvBXfhvJ/elzZjO9XPU4IKnTXADNiA6eg@vger.kernel.org, AJvYcCVed9kO+54HCOJgDkCwvKtgJY5vXbkkSBgyUjU14ydq1mZHXbH53+YpYvwZfn7USZtS15wb2OlN3Eac@vger.kernel.org X-Gm-Message-State: AOJu0YxyKH5Fl4vi1usbE8I254yGZEISzRHmR9YXDa0zqTSmkMqQ4+NT zCUSbLcagKeldoHFGuSmSIKLO+oJT7E/4clNeOj14a3cS9ngmVJY X-Google-Smtp-Source: AGHT+IEJp+m0Jpit3d1pRQq5nNlE4wR495DAdAHCHhI6QD/jsa+DR7oHB/bO7SMdmcjOM/7vZpIFRQ== X-Received: by 2002:a05:6402:26c5:b0:5c8:8505:a803 with SMTP id 4fb4d7f45d1cf-5c88505a899mr9095944a12.26.1727642337949; Sun, 29 Sep 2024 13:38:57 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-e2c0-9a60-64a8-717a.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:e2c0:9a60:64a8:717a]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c8824051c2sm3487985a12.19.2024.09.29.13.38.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Sep 2024 13:38:57 -0700 (PDT) From: Javier Carrasco Date: Sun, 29 Sep 2024 22:38:49 +0200 Subject: [PATCH 4/7] iio: light: veml6070: add support for a regulator 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-Transfer-Encoding: quoted-printable Message-Id: <20240929-veml6070-cleanup-v1-4-a9350341a646@gmail.com> References: <20240929-veml6070-cleanup-v1-0-a9350341a646@gmail.com> In-Reply-To: <20240929-veml6070-cleanup-v1-0-a9350341a646@gmail.com> To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1727642327; l=891; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=f9tArTOelwRcZuYp5DRYRxrU8hSv0bj1O9hFv/wqYb4=; b=V743tVlfi96fCEO2tNfNNOdCVfh/xNqWxAzRGVlLC+JdTQ8fts1vSsHsalQzAhRj3UK68eqBP 078HWVYet3dBKf04/zYJvmiEgFbvaBk1dYtq/hplvewwv8a6L/69gGO X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Add support for a device-managed regulator with the reference name provided in the datasheet (vdd). Signed-off-by: Javier Carrasco --- drivers/iio/light/veml6070.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/iio/light/veml6070.c b/drivers/iio/light/veml6070.c index d15caebdc959..faba04e1da98 100644 --- a/drivers/iio/light/veml6070.c +++ b/drivers/iio/light/veml6070.c @@ -163,6 +163,10 @@ static int veml6070_probe(struct i2c_client *client) indio_dev->name =3D VEML6070_DRV_NAME; indio_dev->modes =3D INDIO_DIRECT_MODE; =20 + ret =3D devm_regulator_get_enable(&client->dev, "vdd"); + if (ret < 0) + return ret; + data->client2 =3D i2c_new_dummy_device(client->adapter, VEML6070_ADDR_DAT= A_LSB); if (IS_ERR(data->client2)) { dev_err(&client->dev, "i2c device for second chip address failed\n"); --=20 2.43.0 From nobody Thu Nov 28 17:45:31 2024 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 E5020184533; Sun, 29 Sep 2024 20:39:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727642344; cv=none; b=PnImZaRrQLRnGkvFI214dnbRJNRGXjqIZ9+QascL46gt7tdoelp5LajIxP88A3Lwj6L43XUsaAKY9WmIAIwKx3vxSadBgeBeNwgU1YiWU+PLb55m+SgKIrFWh5uUlmFGikPro+Ocd4SxVmVlJDCS7+ByXGjCVFXjo98iAQf9QWE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727642344; c=relaxed/simple; bh=2fxmLED2bkXw7zJnbmJoNk12B0MjZHuktZkG9RBX83s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bz8vKyxjLfb2OUzlJqoCOGSDNby7EIJkEl6ChE9+prM0EgIFrb4js2HQQ5BAiPJQRmFt5vg3Sp+lDnixUCOAYpb6jZGnmAbbuFlbS2TOH9lVkrC/p9V9UcD7VovzTqyrCk1Kd0XQT5/nDtrjkTvkCnoDhi3R7VV2Pda5FFB5sW8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=S1upLxD9; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="S1upLxD9" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5c89668464cso795101a12.1; Sun, 29 Sep 2024 13:39:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727642341; x=1728247141; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=eMysew5K9lnvvjxpQ58+D4vAE5LMvIeMSdI3Jzv40Ow=; b=S1upLxD9qOH5GUyfZ4keiUt9ndzVW0wQk47hOXrbMeD+XTJhzxuNaqOuR7+Weg3b9F 6HPox1Dw/vHtX5e6EfvqNtTLf3EBNeBpTKF4oS0Kaa1ov5PD892e6KOjv+GKhy2g2+8O q99LSUYSj1QXsJEitJw6oIGhsFxNiHt3pNohAA2cUJB6Cwk8d/BeCQrWFfyv7Gs8nZl2 NDCXjmK8AUl3koWHqem713svzCaa2xP2EWSEsdi9ITe8Mb+WGjbqyZAjFTpRc3lh15iS QM3vvZZh+P9NhhmSpKc1hGZLFjVapb+ieP+FT+DNq96DWU0FzaLbMRF0OQs8TydFTku6 S6fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727642341; x=1728247141; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eMysew5K9lnvvjxpQ58+D4vAE5LMvIeMSdI3Jzv40Ow=; b=wr5lxBfVVo4z075syBU2wX6aaXte+oOjbq3GPZLw7U1hh1IZ6/OOseZYp9z7q1mQB1 dmLBzLSRxbHh7WK4zp69EGWAPztZFYL3BzcIjiFG8U7xD+xX4Xc1EPbe2Dxl0pat8DKJ DHSYqeX+LRnmFSj2xtl0Zk7kLfqLQYqKdUJRs+RnrWYfXgGVB5TCYbiR40iL4grT0P+O n0PuRSJYQSS2chrUcWhcdCzdP8eMfF97rtChigYh+ouLENVedMLc4GUIh6LO9qAJgOPK 5dfMx0x6/JvFmTHI1Y8/eCZC7Mr/zO4rkcIW80HM30Oymoj3mJObkTJ7rsVQ9P2O5swy Y1pQ== X-Forwarded-Encrypted: i=1; AJvYcCV/n1ZUComubJaPNo54qON6VP+sw55rxw8QZ6K5UnU1luG9jiFIyMMOJyK5sM/j2hPrIG6nb5sNKozeqRV6@vger.kernel.org, AJvYcCWwu0fEY8GBJYjskFTToX6xIVWcTLX6uEE33HTr05z0WxBCv8qw00GBuHfQ4HaQ80AeXHMd7UtcDaOi@vger.kernel.org X-Gm-Message-State: AOJu0YytRuikteue4ofeni7akoaYn88r6dK7rH18s2XLjj9rgxp760Ux t77LTSgbIsRBHmBXd2UoVDaAVGglcFE/dVsbscfheBOep7O10Xbh X-Google-Smtp-Source: AGHT+IEBQfuYQ/crL7twzbTKCaCyZNl9oZB9cDvm5zTmCR8cMnKI7PlQRCJ0ITmjW3+07cP0sTGIbQ== X-Received: by 2002:a05:6402:51cc:b0:5c8:9459:b9f1 with SMTP id 4fb4d7f45d1cf-5c89459bbb1mr2280288a12.13.1727642341164; Sun, 29 Sep 2024 13:39:01 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-e2c0-9a60-64a8-717a.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:e2c0:9a60:64a8:717a]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c8824051c2sm3487985a12.19.2024.09.29.13.38.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Sep 2024 13:38:59 -0700 (PDT) From: Javier Carrasco Date: Sun, 29 Sep 2024 22:38:50 +0200 Subject: [PATCH 5/7] dt-bindings: iio: light: vishay,veml6075: add vishay,veml6070 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-Transfer-Encoding: quoted-printable Message-Id: <20240929-veml6070-cleanup-v1-5-a9350341a646@gmail.com> References: <20240929-veml6070-cleanup-v1-0-a9350341a646@gmail.com> In-Reply-To: <20240929-veml6070-cleanup-v1-0-a9350341a646@gmail.com> To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1727642327; l=1151; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=2fxmLED2bkXw7zJnbmJoNk12B0MjZHuktZkG9RBX83s=; b=Kv6YXGSFet1aI7iyDokB6Nm6g6T9lPqgnCr23bOgJ4/r9g5hdi+NmwXX5OxDGAM1yfumDeysE tgg5JSZb4MJB8MRS0Tc8pwzLgFaVRbrkwIxnyLVxemhgWZMrN71x7sP X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= This UVA device with I2C has the same properties as the veml6075, and the same dt-bindings can cover it too. Signed-off-by: Javier Carrasco Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/iio/light/vishay,veml6075.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/iio/light/vishay,veml6075.ya= ml b/Documentation/devicetree/bindings/iio/light/vishay,veml6075.yaml index ecf2339e02f6..96c1317541fa 100644 --- a/Documentation/devicetree/bindings/iio/light/vishay,veml6075.yaml +++ b/Documentation/devicetree/bindings/iio/light/vishay,veml6075.yaml @@ -4,7 +4,7 @@ $id: http://devicetree.org/schemas/iio/light/vishay,veml6075.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# =20 -title: Vishay VEML6075 UVA/B and VEML6040 RGBW sensors +title: Vishay VEML6070 UVA, VEML6075 UVA/B and VEML6040 RGBW sensors =20 maintainers: - Javier Carrasco @@ -16,6 +16,7 @@ properties: compatible: enum: - vishay,veml6040 + - vishay,veml6070 - vishay,veml6075 =20 reg: --=20 2.43.0 From nobody Thu Nov 28 17:45:31 2024 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 1CA4C185954; Sun, 29 Sep 2024 20:39:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727642346; cv=none; b=hLchEB5CbVUv2DuPYkJy0wglwEamwu90Q3SSJrgfBxIW1Ocehok/h4Wqi8utkm75cHoVaLSv2ROOqXoTO0cdkrClw+cf2f4lD8B/XVCc3T/fjFqxS6cFFrulC4T2S3V4VwR7CZbX+P96HfK897DHoF7CVOvQwp61p/kdvxUThhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727642346; c=relaxed/simple; bh=GxpFD4n+UOKfDv0dYLS/5z/NDDKPjNwuLx4KutIecnA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fAjzZkWxpcpAtmcaiR4DG6Lsd5u/AUmqqoAHjD9Yb2LuDhUWFRMNeFjtaWfjQ4rDIzdrT5e0PWJ0Wq4ZAKQJi8TO3WYNjAHKHEVdssC+Ehg0KMFmjyrHnXT+potH5JccmuxlhCbPsPFA4q+bEnJ7a6yZSS1Y2oNCmPgNFYYOUpg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JBYbdUAF; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JBYbdUAF" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5c88370ad7bso3090049a12.3; Sun, 29 Sep 2024 13:39:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727642343; x=1728247143; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3xGWWtQWL8H06GfqAD60uT9oc1UGLA/x5EVLWu1GowA=; b=JBYbdUAFwSgolB5NAT7xClR2orSlStfY1LxoOYYeJ2gGUza81CsXlilgpVzU9src+t GRyw18CtdwKmqrPRdbmLInZCrz5dbVIvEoRAMI2HbGCQLFOlYYFzjgHYCDYnUzNPPa5k Ey9i9eSNLPHXel2wsz1bgambRcd40IBpUioJM5JHSskLTKrrxPo48DFd4bYqqY/Ch4L4 eJaS0HxfOxh07R+GDY9kcTX7TQKED+s+LRiWEPFLhTFn94v+6TFGUP+YopGuOzD97o4x HRqkQFkQ9W2sFLgytTKTccm8XmeLMffsB1qfmxbzPedjFhHX+G9xMtkWepHtwrg8exQ6 gKxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727642343; x=1728247143; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3xGWWtQWL8H06GfqAD60uT9oc1UGLA/x5EVLWu1GowA=; b=riLVxaacsVhirHW33MPdDp4rIYEotLGnK9OIt9gIsIGPTiWqZmQ/BaEXWVBChTBqTe 0GyLmDFZQMxqwrnmLX8EoXyu66BmhMHfuwmUQ5wPNbiCqpEn5I2RopBQhOg5XjQDqr5C TQLXOWSGJpe99C+n9ihjyQR76d/eufPDTGTLfpZY9o/3GGKKzq1DkXWXpcsquJCtY7Un sVw7dE0bPd1GNuU5PYGCx18FnXvZ+e9oaZEXyvsGnCj97sduW65dVxRcBiDQ8i3lqyqP 9qGy+/uxeBykGWwLbsniByEiy7Emcl747QTPthMxV6qQIbXv/og/cDcY+xnLdqJx7ox8 9dZw== X-Forwarded-Encrypted: i=1; AJvYcCWN41IqFlci5YPWwqMTVyL95whCca4hXnXZU5M4qeg4AYRzbDQqb7rquiN9pYG+2EhnugcTLndyLREWYd8J@vger.kernel.org, AJvYcCXnnOJ2zm6EqFJSrKLb0RjoQCWx73q2B06CxoWscvBemgS6cY3bVjFQ4RWLRPt9f+44rmMC+rc49wUb@vger.kernel.org X-Gm-Message-State: AOJu0YwqiTmCHaBnD1xm0TZgDj0KJR8AeoAM1zbRB4SwtpjRW7HKPmlZ NNXC65b+TitSPBeVNEfM3b+1+QZfxr/xjaQmxrPiDYn3ew6URInh X-Google-Smtp-Source: AGHT+IGu3Vks+yZ+loKrkQH9ea7mdAQIlCq3hnmwIqNsSVIxKhDG6FaKhbebTZ47rQ4DzIGO89XgjA== X-Received: by 2002:a05:6402:1ecf:b0:5c6:cf72:fcbc with SMTP id 4fb4d7f45d1cf-5c882602745mr9201341a12.24.1727642343298; Sun, 29 Sep 2024 13:39:03 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-e2c0-9a60-64a8-717a.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:e2c0:9a60:64a8:717a]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c8824051c2sm3487985a12.19.2024.09.29.13.39.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Sep 2024 13:39:02 -0700 (PDT) From: Javier Carrasco Date: Sun, 29 Sep 2024 22:38:51 +0200 Subject: [PATCH 6/7] iio: light: veml6070: add devicetree support 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-Transfer-Encoding: quoted-printable Message-Id: <20240929-veml6070-cleanup-v1-6-a9350341a646@gmail.com> References: <20240929-veml6070-cleanup-v1-0-a9350341a646@gmail.com> In-Reply-To: <20240929-veml6070-cleanup-v1-0-a9350341a646@gmail.com> To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1727642327; l=880; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=GxpFD4n+UOKfDv0dYLS/5z/NDDKPjNwuLx4KutIecnA=; b=783uxrwHsIhBRrVFri3zubB5JaA85shfbkiYFD7Uddc5wYMEcsEKfuIXNviDh/JH2Q2xhlHN8 dfEmcEnXH/bCL15RJ7vimBHk9P6OB6Z4+kHSerdeClrPRcmIig2V4nm X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Register the compatible from the dt-bindings. Signed-off-by: Javier Carrasco --- drivers/iio/light/veml6070.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/iio/light/veml6070.c b/drivers/iio/light/veml6070.c index faba04e1da98..8d02899028d8 100644 --- a/drivers/iio/light/veml6070.c +++ b/drivers/iio/light/veml6070.c @@ -192,9 +192,16 @@ static const struct i2c_device_id veml6070_id[] =3D { }; MODULE_DEVICE_TABLE(i2c, veml6070_id); =20 +static const struct of_device_id veml6070_of_match[] =3D { + { .compatible =3D "vishay,veml6070" }, + {} +}; +MODULE_DEVICE_TABLE(of, veml6070_of_match); + static struct i2c_driver veml6070_driver =3D { .driver =3D { .name =3D VEML6070_DRV_NAME, + .of_match_table =3D veml6070_of_match, }, .probe =3D veml6070_probe, .id_table =3D veml6070_id, --=20 2.43.0 From nobody Thu Nov 28 17:45:31 2024 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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 BF7171862B3; Sun, 29 Sep 2024 20:39:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727642349; cv=none; b=Vu3aPBWCe5eObY8/Oo5yNrygx5RAOz/FZg15l9Emhqq9J0OWai+66VqqvYamC/x+HF1X78eQNqzLk2tNEpTFZqVf9zctmT49NR/iSKkvlkdH4YuGZ+y6q3yTKd67j2X6YpAW/5XYpttslAurjnTOgPWmWc8ha/1IErmS8kkcuAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727642349; c=relaxed/simple; bh=nikxwyB1KSy0wsMXbnH8xFpdMCf+mKH8/245lMmqi5s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lJlXcvviVEuAFQNLInh0Ufu1n6XCGb4sbSzgJJC696hpeztN7RJYO6x4Hz9MHbhbE+ex5xHItHxdb9j4uwAvPje5p7d5W30DoII4U9SOfGrhrmeZdhhbzhV/UY6zlfdoGjVmDjoGzFO8CeSF8AJ4bzKs90bbkpfNlPMjC+8OtK8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hHCRTV2b; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hHCRTV2b" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-5c71f1396e4so4587227a12.0; Sun, 29 Sep 2024 13:39:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727642346; x=1728247146; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=YYZIE0YZeGeQMwblv/AqzD6BdL1SJTh4oD4ee0SlK+8=; b=hHCRTV2bnln9Nb6Tfkhn8X9+4DyLYAJ+z/4sRbOF57rPNyRZMbIyb+UANP7g8m96K3 dwIaxQqjrRMJhhN2hKfeONBCvaH7ws8o7L/91sMA4tr5F2mNq2pD1rxgFyPC/XrMQHxf qw2hVwMY59V/tBZCB5AkGMYS6JThuZ7x8nHS9VET0aWuK+HlhlmRddxZCFPcpuBtYxsp BO4n4CthyFxqP1oEEPnqMuuHEjQBwsqgjeZAFAgiK56GyfU7pTzd1KHR8WIqqIA5BR4I hF2p22grb0dSEhlqeQBu0++Kf98F5ch6FWf3jYX49V+Vu2wVUUfbfkaTiiqn1hagVAd2 yDHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727642346; x=1728247146; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YYZIE0YZeGeQMwblv/AqzD6BdL1SJTh4oD4ee0SlK+8=; b=p3Dcimje51WbxRjzAb+wfGmyTlQPFtJY89ZWBwVMhbxbLkFMa4IHkSSf5dPCr6dqT0 0uDtLUzH6ltZiY/zzEuK/ikdr4aELVqWi6LWnOArjwWoArvZt+ABgBE/Qa8bNeWvt+Tw gpgbFwOlxT9PNeXTr8KZ3Wg1gR2Psma5mAPSsoEET8DW2zdcnIhGQ6gVOCClWCyNOWla 1xZZ0wLVy4A+DBhxEu02PLm3vML/03J1zVABLeMHKAT6JMJag8iRxkbKujjcfXJxGttq Ko4G32R1T8iNUJEjbREpAqT9lCOlaRK6LiTvBu6AmVh+R7M9fMSPZ8iTtdjLT/VncwrP vvtw== X-Forwarded-Encrypted: i=1; AJvYcCVFkzxsAkO7GN6mEwvEnzA3z9m8EUjPpP7WaHuflk+kYyhPD7YjZ2W07FvagpSyejTwuauprgL9hF31@vger.kernel.org, AJvYcCX3eqUi01CNHKx5KoF3KLro19ziM5WRYx9kCa+p2OgOgRFKm1zSna6inwqyPacXNHRXWe6PIbWy8DHv9YIZ@vger.kernel.org X-Gm-Message-State: AOJu0YwridxWiicH+u6WBeXs8im5yGiTzcIMOM0G3hyRZDP9SHh9ipeh iPkXRrGj1W/CDR310wGmW1fU68UhtuvvfwrFZrgZGnkkecrwoPjT X-Google-Smtp-Source: AGHT+IHDHCjPgBpORkOeVnZX+PWdwQZyIprUCxSaxxsKI0QYedP98oHO0HOYosJ94oUVNDjt6ZZFiA== X-Received: by 2002:a05:6402:26cb:b0:5c8:95ce:8cc2 with SMTP id 4fb4d7f45d1cf-5c895ce8ea9mr2371572a12.16.1727642346039; Sun, 29 Sep 2024 13:39:06 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-e2c0-9a60-64a8-717a.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:e2c0:9a60:64a8:717a]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c8824051c2sm3487985a12.19.2024.09.29.13.39.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Sep 2024 13:39:04 -0700 (PDT) From: Javier Carrasco Date: Sun, 29 Sep 2024 22:38:52 +0200 Subject: [PATCH 7/7] iio: light: veml6070: use dev_err_probe in probe function 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-Transfer-Encoding: quoted-printable Message-Id: <20240929-veml6070-cleanup-v1-7-a9350341a646@gmail.com> References: <20240929-veml6070-cleanup-v1-0-a9350341a646@gmail.com> In-Reply-To: <20240929-veml6070-cleanup-v1-0-a9350341a646@gmail.com> To: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1727642327; l=1046; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=nikxwyB1KSy0wsMXbnH8xFpdMCf+mKH8/245lMmqi5s=; b=fXk5tBeALOQQi99O7xzi5Ez+vuMPp40DcbCVWauoQW7Glg2WHGabdjBQam9g1F2BYqIRcjpqx ZKYXdy3hWSDC5aHUmCeMVfLtu7Lz3bF9YOd4NRON8RLlzMwwY7+wOBZ X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Drop the common 'dev_err() + return' combination in the probe function and use 'return dev_err_probe()' instead. Signed-off-by: Javier Carrasco --- drivers/iio/light/veml6070.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/veml6070.c b/drivers/iio/light/veml6070.c index 8d02899028d8..6221d07aa840 100644 --- a/drivers/iio/light/veml6070.c +++ b/drivers/iio/light/veml6070.c @@ -168,10 +168,9 @@ static int veml6070_probe(struct i2c_client *client) return ret; =20 data->client2 =3D i2c_new_dummy_device(client->adapter, VEML6070_ADDR_DAT= A_LSB); - if (IS_ERR(data->client2)) { - dev_err(&client->dev, "i2c device for second chip address failed\n"); - return PTR_ERR(data->client2); - } + if (IS_ERR(data->client2)) + return dev_err_probe(&client->dev, PTR_ERR(data->client2), + "i2c device for second chip address failed\n"); =20 data->config =3D VEML6070_IT_10 | VEML6070_COMMAND_RSRVD | VEML6070_COMMAND_SD; --=20 2.43.0