Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2217502/?format=api
{ "id": 2217502, "url": "http://patchwork.ozlabs.org/api/patches/2217502/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260329-ti-ads7950-facelift-v4-3-c568c508c49a@gmail.com/", "project": { "id": 42, "url": "http://patchwork.ozlabs.org/api/projects/42/?format=api", "name": "Linux GPIO development", "link_name": "linux-gpio", "list_id": "linux-gpio.vger.kernel.org", "list_email": "linux-gpio@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260329-ti-ads7950-facelift-v4-3-c568c508c49a@gmail.com>", "list_archive_url": null, "date": "2026-03-29T22:47:08", "name": "[v4,3/4] iio: adc: ti-ads7950: switch to using devm_regulator_get_enable_read_voltage()", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "4d894fda067a16616a0cd8fda7ecacdc9c723154", "submitter": { "id": 695, "url": "http://patchwork.ozlabs.org/api/people/695/?format=api", "name": "Dmitry Torokhov", "email": "dmitry.torokhov@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260329-ti-ads7950-facelift-v4-3-c568c508c49a@gmail.com/mbox/", "series": [ { "id": 497938, "url": "http://patchwork.ozlabs.org/api/series/497938/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/list/?series=497938", "date": "2026-03-29T22:47:07", "name": "ti-ads7950: fix gpio handling and facelift", "version": 4, "mbox": "http://patchwork.ozlabs.org/series/497938/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2217502/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2217502/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-gpio+bounces-34374-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-gpio@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=opsU/Xj2;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-gpio+bounces-34374-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"opsU/Xj2\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=74.125.82.171", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com" ], "Received": [ "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fkV2p4PDgz1y1q\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 30 Mar 2026 09:50:26 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id C0CD230305D8\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 29 Mar 2026 22:47:20 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id AF2B936492C;\n\tSun, 29 Mar 2026 22:47:18 +0000 (UTC)", "from mail-dy1-f171.google.com (mail-dy1-f171.google.com\n [74.125.82.171])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 01B23382397\n\tfor <linux-gpio@vger.kernel.org>; Sun, 29 Mar 2026 22:47:16 +0000 (UTC)", "by mail-dy1-f171.google.com with SMTP id\n 5a478bee46e88-2c66eafc1easo349247eec.1\n for <linux-gpio@vger.kernel.org>;\n Sun, 29 Mar 2026 15:47:16 -0700 (PDT)", "from dtor-ws.sjc.corp.google.com\n ([2a00:79e0:2ebe:8:7265:773a:8e51:c62f])\n by smtp.gmail.com with ESMTPSA id\n 5a478bee46e88-2c3c7971d97sm5840295eec.30.2026.03.29.15.47.14\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 29 Mar 2026 15:47:15 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774824438; cv=none;\n b=dkeP7WwtSEe0WKMrh3gIIQmJVCaN6So6vEMjkIrN0rFICuR23nQNgIZ3FjBucgLcb8wqobYCwT4JqwuDu4bWKLm28X6eB0G5dygVZk+tbrNwALztQz4kkLy+JTAcRW7FFccXtJEXu/7rfLhGmgAZw5LdvLHvE5puCKYhTNt7fGU=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774824438; c=relaxed/simple;\n\tbh=qKG/Dk+YwmU5YXsCQA9AtevlFGr051QfNe264bDQuZg=;\n\th=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:\n\t In-Reply-To:To:Cc;\n b=M8z5HJ83jL9kKr71HLFJu94Qb/282X4VGvKjMT13dtkvw+I9wCn5/UC6FJ1aMGkKJstO4QSltuaXo5es/hdWB2l906sAkb2SuL6o5HjmroTRsxRxg7fCKsC4md+pvAHP78P1QLvB4QitbQa6EmPyovZ/L/6rN5HaKTl361j/aCc=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=opsU/Xj2; arc=none smtp.client-ip=74.125.82.171", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1774824436; x=1775429236;\n darn=vger.kernel.org;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:from:to:cc:subject:date:message-id\n :reply-to;\n bh=xjnte4r6ScLiwT0fTQiZsZDg6SDDULG2OwlHg75Fmwg=;\n b=opsU/Xj2tS3Jtx/E3effpQYBTOCbK/HGgoMi2CjbHvYhmU12HfqKIb1076Xs7nvqmV\n 25U4n1hjBReW14UkhTupn+c66972mwi0iQZD4OmQD4THPqwcvwUwEOte+psWpM/+V/8y\n x2vU/6aVW/23PReohDfzD4d2EwNz6zAgzcTFt4rl5ZvE48WfSp5mU5bdt3XwHG9qHUtw\n adc6dlnOG2GInLtiNf2YSFVlS2IQ906qdyRLWac/IDYyNOVl1RKjHs6o9Ku/SQ51nxVO\n h4VUIOkD0b6O2V0NGUlBjIuInlqqJ6NsZVZuxWRVya9kyGkBohZer4CobqYvS9bGcFNE\n /RRg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774824436; x=1775429236;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=xjnte4r6ScLiwT0fTQiZsZDg6SDDULG2OwlHg75Fmwg=;\n b=pfysN0yc6hwC1a3+gzHvvqeRgn4WfleNdZRUhzn1abOMABFiHukTnSoVjoDPegBOM/\n 2xsN2aFCr9Q6cE13gfdGI3+eWFlPIqxU2Y11VX+GRpLPjkIpTsUeXvM+1RvpEKpbl5D8\n 4azEfKpwK7+sWcEM5cnL+q7yZ+Ub5ugkP74EoZoyj1GP3Efdourc/TjgKYme1+pBOjbC\n k+DrH+Ujjd1drK6tkdCIytvQI3Gi57aIUVmL/+qlIEO1+bcwb8NzzulklCVkqO29ecxT\n nCWkHkrs/A6oTZF9nKG59tSnJBDfczdfH7VBupsP80LhgixKZBqs8QhI5wkjd9mwdScu\n Gg6w==", "X-Forwarded-Encrypted": "i=1;\n AJvYcCXZvM417y4a0cbXgu265CaIqQoGuUQWYd9RvoCEmxN21FqEUic5lBP9NonxNRnFVHOcWUo05I+GvSEC@vger.kernel.org", "X-Gm-Message-State": "AOJu0YzUBrk+rfRtFhkiJbHeCd9y+G3r3i3IBAI3XFVA5fm6mt7zS/bC\n\tkW6xrraKLMuLHXG+mbX/Wl8fFMu+LVeu90FfHecpWiVTcuDJKYWT33ra", "X-Gm-Gg": "ATEYQzys+98PE/+lNThWjQUDoIjgxE+UklhGuZ6kw0a3f9tHlz7kjp175jtk48dztj1\n\tw+2f9ltsTLhAINay8rxDKi8jzfYTCTfSngk9I90HVAMp86EnJrrEqcKS6vq/DR2k+I3N/rpQNzo\n\tED8OjT7THMXXt8TIZMJnI1ix2uSNaWDDVnddJ9iCRTNzapT3FyKugj5vJ2n9FVm7xMv6HP2CWZJ\n\tu9c5IOfncV208wybdM8cxy5cWeEy9BOv3thlSCkHUjdscxi2YlRFXtCGcJBeeiPnoUmqobFncF/\n\t7fAYObxPiL3ZBNpgdvNDRddZby5AZZNKdqvhTGLQGoVSBj4C4i5n7ag2mMisJDqbc5GqvS+FpQO\n\tWpLvRcfNJ+QlwwQh+jhyXqB9Dsb8HEnX8t5LGCfKlEjRPEEZWOnSIxYgvnYPDuAC4ZNAu46wUhR\n\tNjmxOx4BIn7uJn69yaHOlnOGwLVpYpc3nUmiKapxfcKu3Xrmr5SRF66L0IaJzQPknaaIwP9lNSC\n\tFI5FVbY9EOoKLolbKe7OJyGig==", "X-Received": "by 2002:a05:7300:1489:b0:2c5:220c:5673 with SMTP id\n 5a478bee46e88-2c5220c616bmr2019888eec.5.1774824436043;\n Sun, 29 Mar 2026 15:47:16 -0700 (PDT)", "From": "Dmitry Torokhov <dmitry.torokhov@gmail.com>", "Date": "Sun, 29 Mar 2026 15:47:08 -0700", "Subject": "[PATCH v4 3/4] iio: adc: ti-ads7950: switch to using\n devm_regulator_get_enable_read_voltage()", "Precedence": "bulk", "X-Mailing-List": "linux-gpio@vger.kernel.org", "List-Id": "<linux-gpio.vger.kernel.org>", "List-Subscribe": "<mailto:linux-gpio+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-gpio+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20260329-ti-ads7950-facelift-v4-3-c568c508c49a@gmail.com>", "References": "<20260329-ti-ads7950-facelift-v4-0-c568c508c49a@gmail.com>", "In-Reply-To": "<20260329-ti-ads7950-facelift-v4-0-c568c508c49a@gmail.com>", "To": "Jonathan Cameron <jic23@kernel.org>,\n David Lechner <dlechner@baylibre.com>", "Cc": "=?utf-8?q?Nuno_S=C3=A1?= <nuno.sa@analog.com>,\n Andy Shevchenko <andy@kernel.org>, Linus Walleij <linusw@kernel.org>,\n Bartosz Golaszewski <brgl@kernel.org>, linux-iio@vger.kernel.org,\n linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,\n Jonathan Cameron <Jonathan.Cameron@huawei.com>", "X-Mailer": "b4 0.15-dev-a6826" }, "content": "The regulator is enabled for the entire time the driver is bound to the\ndevice, and we only need to access it to fetch voltage, which can be\ndone at probe time.\n\nSwitch to using devm_regulator_get_enable_read_voltage() which\nsimplifies probing and unbinding code.\n\nSuggested-by: David Lechner <dlechner@baylibre.com>\nSigned-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>\n---\n drivers/iio/adc/ti-ads7950.c | 48 ++++++++++++--------------------------------\n 1 file changed, 13 insertions(+), 35 deletions(-)", "diff": "diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c\nindex c31c706c92a9..0b98c8e7385d 100644\n--- a/drivers/iio/adc/ti-ads7950.c\n+++ b/drivers/iio/adc/ti-ads7950.c\n@@ -334,19 +334,9 @@ static int ti_ads7950_scan_direct(struct iio_dev *indio_dev, unsigned int ch)\n \treturn st->single_rx;\n }\n \n-static int ti_ads7950_get_range(struct ti_ads7950_state *st)\n+static unsigned int ti_ads7950_get_range(struct ti_ads7950_state *st)\n {\n-\tint vref;\n-\n-\tif (st->vref_mv) {\n-\t\tvref = st->vref_mv;\n-\t} else {\n-\t\tvref = regulator_get_voltage(st->reg);\n-\t\tif (vref < 0)\n-\t\t\treturn vref;\n-\n-\t\tvref /= 1000;\n-\t}\n+\tunsigned int vref = st->vref_mv;\n \n \tif (st->cmd_settings_bitmask & TI_ADS7950_CR_RANGE_5V)\n \t\tvref *= 2;\n@@ -375,11 +365,7 @@ static int ti_ads7950_read_raw(struct iio_dev *indio_dev,\n \n \t\treturn IIO_VAL_INT;\n \tcase IIO_CHAN_INFO_SCALE:\n-\t\tret = ti_ads7950_get_range(st);\n-\t\tif (ret < 0)\n-\t\t\treturn ret;\n-\n-\t\t*val = ret;\n+\t\t*val = ti_ads7950_get_range(st);\n \t\t*val2 = (1 << chan->scan_type.realbits) - 1;\n \n \t\treturn IIO_VAL_FRACTIONAL;\n@@ -573,30 +559,25 @@ static int ti_ads7950_probe(struct spi_device *spi)\n \tspi_message_init_with_transfers(&st->scan_single_msg,\n \t\t\t\t\tst->scan_single_xfer, 3);\n \n-\t/* Use hard coded value for reference voltage in ACPI case */\n-\tif (ACPI_COMPANION(&spi->dev))\n-\t\tst->vref_mv = TI_ADS7950_VA_MV_ACPI_DEFAULT;\n-\n \tmutex_init(&st->slock);\n \n-\tst->reg = devm_regulator_get(&spi->dev, \"vref\");\n-\tif (IS_ERR(st->reg)) {\n-\t\tret = dev_err_probe(&spi->dev, PTR_ERR(st->reg),\n-\t\t\t\t \"Failed to get regulator \\\"vref\\\"\\n\");\n-\t\tgoto error_destroy_mutex;\n-\t}\n+\t/* Use hard coded value for reference voltage in ACPI case */\n+\tif (ACPI_COMPANION(&spi->dev)) {\n+\t\tst->vref_mv = TI_ADS7950_VA_MV_ACPI_DEFAULT;\n+\t} else {\n+\t\tret = devm_regulator_get_enable_read_voltage(&spi->dev, \"vref\");\n+\t\tif (ret < 0)\n+\t\t\treturn dev_err_probe(&spi->dev, ret,\n+\t\t\t\t\t \"Failed to get regulator \\\"vref\\\"\\n\");\n \n-\tret = regulator_enable(st->reg);\n-\tif (ret) {\n-\t\tdev_err(&spi->dev, \"Failed to enable regulator \\\"vref\\\"\\n\");\n-\t\tgoto error_destroy_mutex;\n+\t\tst->vref_mv = ret / 1000;\n \t}\n \n \tret = iio_triggered_buffer_setup(indio_dev, NULL,\n \t\t\t\t\t &ti_ads7950_trigger_handler, NULL);\n \tif (ret) {\n \t\tdev_err(&spi->dev, \"Failed to setup triggered buffer\\n\");\n-\t\tgoto error_disable_reg;\n+\t\tgoto error_destroy_mutex;\n \t}\n \n \tret = ti_ads7950_init_hw(st);\n@@ -636,8 +617,6 @@ static int ti_ads7950_probe(struct spi_device *spi)\n \tiio_device_unregister(indio_dev);\n error_cleanup_ring:\n \tiio_triggered_buffer_cleanup(indio_dev);\n-error_disable_reg:\n-\tregulator_disable(st->reg);\n error_destroy_mutex:\n \tmutex_destroy(&st->slock);\n \n@@ -652,7 +631,6 @@ static void ti_ads7950_remove(struct spi_device *spi)\n \tgpiochip_remove(&st->chip);\n \tiio_device_unregister(indio_dev);\n \tiio_triggered_buffer_cleanup(indio_dev);\n-\tregulator_disable(st->reg);\n \tmutex_destroy(&st->slock);\n }\n \n", "prefixes": [ "v4", "3/4" ] }