From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.52 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796319218; b=kyOWLc3y/JfQfIpEvsmO6BML6abLJvJAef02PM1otcsB4Ir36tcVtpz3s268HknTJHEk I9ClrEAR0lQH81Ur20PuCGiPbEVI4GrFbf5KuX5hwhfNV8gAB/nwyUCHuxhkudLKm/E7l nDyFZ+mJLIxx67iVa/kN2PfeB2CcmYy8TyDYNCiq5Km8/ccBms7bu9hwHdgk8IVVJA/zC fuL1PA4LOSuTNdsSpkZI8uGPbunubhTo/28h7kb4FIWNCNlHQmEzHRWHK5bGq+ELKnU9x yUaQyZ52zYT1NDVn6sru/C1ZaE+RRoJqCwTzDAYY5wfbKRPaMD+3UtudJgJs75xHlaQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796319218; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key; bh=SDrOQUasKXhcnBIKVYolcFrj17/ZLirToIrTTqdyrcU=; b=bOL8DrRMRkIZXbF61iVRue2tbJd1XEvLoCpN9k9DdafutRrwLNNvvXu/mP4YpQdMPcrH GeiA6gye2aYx7VDVlfg0m+UfXbDbCIRGL2VYk7U1f4P/J1+Tn8JTrRA3EAGmWoBitZped gSV9MbkmKoCahndVIDwZ+2LbnYJJg3Nnya9DtdvIuSwkPas5rRzZRXnVZA9Jr/GrM8Pf/ qy4xTJvUC8EO0Vg7nk4vs1HDf88tBHJ1f/+djPbrhiXGzX+Z5FOOWSEOZcuaGzbIiI9Jp y0IEWQP/ac5V7vpzED5uSwiRPLlb0SOlSAX+OgX8LQPcWbdD7kJYdZs7DyLe5NNyYJg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Mct67qb1; arc=none smtp.remote-ip=209.85.221.52 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A734606A330 for ; Thu, 3 Dec 2026 17:33:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5A734606A330 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.a=rsa-sha256 header.s=20260707 header.b=Mct67qb1 Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-4b52fcb410dso854227f8f.1 for ; Thu, 03 Dec 2026 09:33:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796319216; x=1796924016; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=SDrOQUasKXhcnBIKVYolcFrj17/ZLirToIrTTqdyrcU=; b=Mct67qb19X1uFI5WZh50NMIkfLZlB3nVd8zXFHhzkSoiDUHllI6EkZ0pUpHMfhojYl 9JUWSL7Edfw+H4IQIcQMREMogoJTbnAefqbJbEmzIq2NYPV5mVoTwID3YQlq/pWCbwre 1LA432l9va28P/hd9U67LTtSiu2HkWOZ2k1Z6Ychnx/JyT0bNqj4zIEBiJxH+WGRqd6a Lv16ivysYmJ2x8aTY/ay8sty5MDSV47Mc/7O4kItlPP802LsW0m9/AnBHjaD48N1Mt6B LfY6KDPztkrt5kU9Fehe+HXEKP3vRZnkVITy34ZsWkYjD8MzgVLPMqRq2YHNJROGZmco ShDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796319216; x=1796924016; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=SDrOQUasKXhcnBIKVYolcFrj17/ZLirToIrTTqdyrcU=; b=GeGPNzsjRZdLhBfxk3Ie686/Ag8VsNuBJRQb5LOf6C6owqWVdsL4iAORzpwWdLpLwv T9v93mS3eCLXtFfbMyDFPWzmNvDTltPvd7q3AVt78OT+FllkfCwetDyUk0TTMWzNxgR6 Jnvj4i56UyeRI/EgGvWv9A/h5JjiB6VyuXnh2F0bel1oCPaUTmoiGJEBO6qobvTpP7AZ Vcz2+XPvqDFEOJloradd9fyDGcVoomCIz44cE8IZRU9C9tQnNVcYJPumPq7BJarT6aT7 PA/4BTxPSY61yYN6CLbPAD1mDsgEUPDyNTTmPh/r3qafIsEQfGITIDozgR7TzIqz22R+ 7JEw== X-Forwarded-Encrypted: i=1; AL+hErG5+LnUYwTzyYNeqxJ1382p2FDPtywz5NiP6SNlKGqe30YKlrchGJpnADz5skGCAMHylPXoBi2BlNrO184=@vger.kernel.org X-Gm-Message-State: APuU4Z9dqhZGF5fIvOEc3y8sQuBpqLZVH7jk1E5n+d9ZiAh8I2IDq48W jzW2g02qL/Yzw9qAjI+hbIStipsg2O8Apyg8m7T10l0ZlAhXD1cwsW0x X-Gm-Gg: AZFdTZc/WdHijUuTPco9quiSU5KJE0XQzbpl9ayftqqrJ6e4vFnl6gNtc3+jswjw/uA qUjeitpS2P+drLjrOMHHQhLIr72j26hLNYE9OiIW9KYMvk7PpcvQ9ux1U5df9iNWWqqbuXufOyI nOhBwDjtdXioYfNbTC5rL+iKRfdCaKkKFIcFUtOxRxoT0hhMzOglvnt1yCLbWRz4wFEinQw/8tX 5VG5SsdAyuMcCa6ZAlxrEuTLCWBoaneQO22IGRQmCozfXneW06RWDrsF3Dgo2JaC1HgT/m2LJjG DofYm6/BXde7EGFTTMVmW7i000tF88BEWhcjQ/yBTEKtDaXbgmO3kt3MrOjkmpKNFcLli4JhOg7 Vad08ETWMTQHLlypO0SLjIRY/Bum0sBz7snOeTrhTQku01MyRbtD05dIh8orotPniOXjLblvFFq dMwnJQ1dXmv3XpC4ZOVWLlRh71/pu0xfbWQNT/fOYSli1rJiUOEmgWdYdLNhCxDgxhsI+FzF/Yu xhyNyq1uyKk4e86vsSn/c0KVVfZim9VbvGnrkaxAPDgfvgdHNBKV+3qQJFBUQE3T4G8e9dZuA1B YykryMXlwDNJP+7vhGwHuGJpt3xHqYRhQZknfMph2u4iwG8LnW9JVA== X-Received: by 2002:a7b:cc0e:0:b0:4a1:c6f5:2450 with SMTP id 5b1f17b1804b1-4bbe199b5edmr36848345e9.17.1796319215804; Thu, 03 Dec 2026 09:33:35 -0800 (PST) Received: from [192.168.100.235] ([154.182.95.194]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbe0066657sm74447655e9.11.2026.12.03.09.33.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 09:33:35 -0800 (PST) From: Abdelnasser Hussein Date: Thu, 03 Dec 2026 19:30:08 +0200 Subject: [PATCH v6 4/8] iio: adc: at91_adc: convert to device_property_*() APIs X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261203-at91-adc-v6-v6-4-bfa754299f54@gmail.com> References: <20261203-at91-adc-v6-v6-0-bfa754299f54@gmail.com> In-Reply-To: <20261203-at91-adc-v6-v6-0-bfa754299f54@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Maxime Ripard , Greg Kroah-Hartman , u.kleine-koenig@baylibre.com Cc: linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Abdelnasser Hussein X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796319202; l=5424; i=abdelnasserhussein11@gmail.com; s=20261130; h=from:subject:message-id; bh=wAkuaBm1arqNxAQkuJiGxxk2eICihWNmOmvvRKKAtUw=; b=nwzSMDtebwn7VJrPAkGQYVtR4QqQrcxSt+/5PU87kQRKuZLv7/POeqBPq0uLBMqjz46XTsdXG yyRUpy4oTNfCrBoKTVBrFdf/rL+lsJUj8Zpf63ie0Ew+9qkPPf/HbMR X-Developer-Key: i=abdelnasserhussein11@gmail.com; a=ed25519; pk=Dmo6Edgd8J/+KWpQVKEL2K7SRVNAVmPL14Bhmt3tWrY= Read the atmel,adc-* properties through device_property_*() in at91_adc_probe() and at91_adc_probe_ts(), dropping the local device_node. Use a local struct device pointer and a propname variable, return the actual property-read error with the property name in the message, and replace the atmel,adc-use-res string comparison with device_property_match_string(). With the of_* helpers gone, drop ( already provides struct of_device_id). Signed-off-by: Abdelnasser Hussein --- drivers/iio/adc/at91_adc.c | 60 +++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 9439eef7b564..cbaad9473239 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -798,13 +797,14 @@ static u32 calc_startup_ticks_9x5(u32 startup_time, u32 adc_clk_khz) return ticks; } -static int at91_adc_probe_dt_ts(struct device_node *node, - struct at91_adc_state *st, struct device *dev) +static int at91_adc_probe_ts(struct device *dev, struct at91_adc_state *st) { + const char *propname; int ret; u32 prop; - ret = of_property_read_u32(node, "atmel,adc-ts-wires", &prop); + propname = "atmel,adc-ts-wires"; + ret = device_property_read_u32(dev, propname, &prop); if (ret) { dev_info(dev, "ADC Touch screen is disabled.\n"); return 0; @@ -822,15 +822,20 @@ static int at91_adc_probe_dt_ts(struct device_node *node, if (!st->caps->has_tsmr) return 0; + prop = 0; - of_property_read_u32(node, "atmel,adc-ts-pressure-threshold", &prop); + propname = "atmel,adc-ts-pressure-threshold"; + ret = device_property_read_u32(dev, propname, &prop); + if (ret) + return dev_err_probe(dev, ret, "Missing %s property.\n", propname); + st->ts_pressure_threshold = prop; - if (st->ts_pressure_threshold) { - return 0; - } else { + if (!st->ts_pressure_threshold) { dev_err(dev, "Invalid pressure threshold for the touchscreen\n"); return -EINVAL; } + + return 0; } static const struct iio_info at91_adc_info = { @@ -998,12 +1003,12 @@ static void at91_ts_unregister(struct at91_adc_state *st) static int at91_adc_probe(struct platform_device *pdev) { unsigned int prsc, mstrclk, ticks, adc_clk, adc_clk_khz, shtim; - struct device_node *node = pdev->dev.of_node; + struct device *dev = &pdev->dev; + const char *propname; int ret; struct iio_dev *idev; struct at91_adc_state *st; u32 reg, prop; - const char *s; idev = devm_iio_device_alloc(&pdev->dev, sizeof(struct at91_adc_state)); if (!idev) @@ -1015,33 +1020,38 @@ static int at91_adc_probe(struct platform_device *pdev) if (!st->caps) return -ENODATA; - st->use_external = of_property_read_bool(node, "atmel,adc-use-external-triggers"); + propname = "atmel,adc-use-external-triggers"; + st->use_external = device_property_read_bool(dev, propname); - if (of_property_read_u32(node, "atmel,adc-channels-used", &prop)) - return dev_err_probe(&idev->dev, -EINVAL, - "Missing adc-channels-used property in the DT.\n"); + propname = "atmel,adc-channels-used"; + ret = device_property_read_u32(dev, propname, &prop); + if (ret) + return dev_err_probe(dev, ret, "Missing %s property.\n", propname); st->channels_mask = prop; - st->sleep_mode = of_property_read_bool(node, "atmel,adc-sleep-mode"); + propname = "atmel,adc-sleep-mode"; + st->sleep_mode = device_property_read_bool(dev, propname); - if (of_property_read_u32(node, "atmel,adc-startup-time", &prop)) - return dev_err_probe(&idev->dev, -EINVAL, - "Missing adc-startup-time property in the DT.\n"); + propname = "atmel,adc-startup-time"; + ret = device_property_read_u32(dev, propname, &prop); + if (ret) + return dev_err_probe(dev, ret, "Missing %s property.\n", propname); st->startup_time = prop; prop = 0; - of_property_read_u32(node, "atmel,adc-sample-hold-time", &prop); + propname = "atmel,adc-sample-hold-time"; + device_property_read_u32(dev, propname, &prop); st->sample_hold_time = prop; - if (of_property_read_u32(node, "atmel,adc-vref", &prop)) - return dev_err_probe(&idev->dev, -EINVAL, - "Missing adc-vref property in the DT.\n"); + propname = "atmel,adc-vref"; + ret = device_property_read_u32(dev, propname, &prop); + if (ret) + return dev_err_probe(dev, ret, "Missing %s property.\n", propname); st->vref_mv = prop; st->res = st->caps->high_res_bits; if (st->caps->low_res_bits && - !of_property_read_string(node, "atmel,adc-use-res", &s) - && !strcmp(s, "lowres")) + device_property_match_string(dev, "atmel,adc-use-res", "lowres") >= 0) st->res = st->caps->low_res_bits; dev_info(&idev->dev, "Resolution used: %u bits\n", st->res); @@ -1051,7 +1061,7 @@ static int at91_adc_probe(struct platform_device *pdev) /* Check if touchscreen is supported. */ if (st->caps->has_ts) { - ret = at91_adc_probe_dt_ts(node, st, &idev->dev); + ret = at91_adc_probe_ts(dev, st); if (ret) return ret; } -- 2.56.0