From patchwork Mon Mar 4 14:40:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 209662 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1578327dyc; Mon, 4 Mar 2024 09:46:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVUZy1+jdCVvmgEnvGKAUdYp6TuvP7t9GGj4Gby0ZDZreBS56kv5OxPexXBh+udJp/O/5Tp4ilvC3HdqmdZiUCfVj+Q8Q== X-Google-Smtp-Source: AGHT+IFwyUk6SU725XsRUP76KdZmCdBr3cVbYeTi2PRoZlIZR60EpmW8sJ0jIwOrecKph1M//K46 X-Received: by 2002:a17:906:35c9:b0:a45:64c1:cb01 with SMTP id p9-20020a17090635c900b00a4564c1cb01mr1948968ejb.26.1709574411565; Mon, 04 Mar 2024 09:46:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709574411; cv=pass; d=google.com; s=arc-20160816; b=Dl/7v0QDTjftLxlULTXngd54C/+CfvSUR900Y4z681G9i98yjOpFccQHyp+D/PkWZG ZYC48cVnq/+LQxiAlUTinGAPY4Z8cht3n/v4JNCCdJBDadJu3VfSoKBpFpKB9SZJdWgM ++7Kc39sx712N2TAxRF8jm7HGXTT9hteWIRCI06xfCB6+iqrvBgk9FiaVxgwhVbuUiwU zTklen53MQELwKgOc7CpdA0lf1gBuQXsHCJuq4Qj78TIb9XSkfDyNwcYuqjIikb9iycS ApplHpwzQQv26U3DLG9udxxmJg6EWeka54a+prIS0l7lG1ntSuaSawYZS+OhVKwLRyC1 FAHA== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=uXljuvu5Wc20Dfr+WDFr5jNeZEHqBLtOeGmGrrepv2M=; fh=B/lAw/RZiW2xJ92yiMBaVyzsPyn+5aUdj7gFMmX3Ig0=; b=AfrcuZYjEojwWUMFJJqJGD09MBIdV5gXQD0VhErLxaq0/L3izh9BE4Tz8KLyxQqoF9 PFV07XUkznemo9AqTxtqMMNMxeADOi58IUwcF69GC9EPz1z8egSDtAtgz255/K3dTPz/ HDMWQeWDuwGv9SHCCSbPeuNhcFozZdOov8uyr9XiJcyOyEOny21E9QryiJNSIZlPrxxh wg4Pdb+MNOHG2NHGsf4ug7bhJ7OkMxsDM/y7mJow5Vh0QVQva0rUc3+iDX/tsB5GbE00 avchWULB9uya+SgtluSDmzXngr4mHF8m8CJ12NIRe0McY2rk84/1/l0/CV1KOnB/0oKA 9GJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mLQ7elNH; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-90751-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90751-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h23-20020a1709062dd700b00a41db310911si4104696eji.729.2024.03.04.09.46.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 09:46:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90751-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mLQ7elNH; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-90751-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90751-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 554F11F21B88 for ; Mon, 4 Mar 2024 14:41:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E21F247A67; Mon, 4 Mar 2024 14:40:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mLQ7elNH" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (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 80C251E484; Mon, 4 Mar 2024 14:40:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709563245; cv=none; b=V52WmP08tdP8XEHXHZvoYjef6UjPUdeY7Pw2HYN633kju1u5a3bYagT5Tbgkru8sDKD6/VJ1Qj1pcHqqzSdJ/omcA/qH5y312eNREoIDXT1ht/w1ndw6TNREPIpHdtdCs0Zt6YpMrdbBfIPbbnmhx4i4vTxWZHN4jBeqmyAlTqU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709563245; c=relaxed/simple; bh=zIjlGZfedJV9OUraq9VXgB71J74hXHMlhetn5zUkDYY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=NN8ZWYAAcu0JQcvVv/A1EROtLk6jBPJM7AuAblqgT5FPQCM+KaZkykrn4R4iZF19tjyJ0+6/qkyKW0jp0kyAfS0U4HlNNtV3X+fiOpDBDgryOw24XxiUWWalFcN2Y9XFbtId7tNco9E6gaYmm9PGJ5eWoBjY0I0TSBjAFTVOPIU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mLQ7elNH; arc=none smtp.client-ip=198.175.65.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709563243; x=1741099243; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=zIjlGZfedJV9OUraq9VXgB71J74hXHMlhetn5zUkDYY=; b=mLQ7elNHI8fwuBeu4AYTe6OpbLIKWl8hK8wbHP33G/7uU8n5JEY5frpb qAYnHCBJM98RPbR3NemmPky+UEhhgabmAaFE4OOr6AbqFFvzv7lDnpFNh /UtQ6l1x7UaMTuncvQkhWqYW0VQfN76tKRlzP438BPj48/qOQbg5WxMeH H/BMOa+fTMYiwmOJL7w53oC+WUNzMHTed4gbUHVXZUiy5CX7LDhaoyFzD Vp+RglKXEgkR0pMl7ob4XsME1TcXPhjXWzr5FBMFLO1S1FodQT6QTO0hs NIcF+yshUdMakT/npTuW8bd3zRUXG2JL2iqZ5uV0HfUq+OZW0gOYKZKLo A==; X-IronPort-AV: E=McAfee;i="6600,9927,11002"; a="4218619" X-IronPort-AV: E=Sophos;i="6.06,203,1705392000"; d="scan'208";a="4218619" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2024 06:40:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11002"; a="937040615" X-IronPort-AV: E=Sophos;i="6.06,203,1705392000"; d="scan'208";a="937040615" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 04 Mar 2024 06:40:40 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id E9A1715C; Mon, 4 Mar 2024 16:40:38 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v2 1/1] iio: adc: twl4030-madc: Make use of device properties Date: Mon, 4 Mar 2024 16:40:06 +0200 Message-ID: <20240304144037.1036390-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792618698138613804 X-GMAIL-MSGID: 1792618698138613804 Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. Include mod_devicetable.h explicitly to replace the dropped of.h which included mod_devicetable.h indirectly. Signed-off-by: Andy Shevchenko --- v2: converted leftover (Jonathan) drivers/iio/adc/twl4030-madc.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c index 4a247ca25a44..0253064fadec 100644 --- a/drivers/iio/adc/twl4030-madc.c +++ b/drivers/iio/adc/twl4030-madc.c @@ -19,10 +19,12 @@ #include #include #include +#include +#include #include +#include #include #include -#include #include #include #include @@ -30,7 +32,6 @@ #include #include #include -#include #include #include @@ -744,14 +745,14 @@ static int twl4030_madc_set_power(struct twl4030_madc_data *madc, int on) */ static int twl4030_madc_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; + struct twl4030_madc_platform_data *pdata = dev_get_platdata(dev); struct twl4030_madc_data *madc; - struct twl4030_madc_platform_data *pdata = dev_get_platdata(&pdev->dev); - struct device_node *np = pdev->dev.of_node; int irq, ret; u8 regval; struct iio_dev *iio_dev = NULL; - if (!pdata && !np) { + if (!pdata && !dev_fwnode(dev)) { dev_err(&pdev->dev, "neither platform data nor Device Tree node available\n"); return -EINVAL; } @@ -779,7 +780,7 @@ static int twl4030_madc_probe(struct platform_device *pdev) if (pdata) madc->use_second_irq = (pdata->irq_line != 1); else - madc->use_second_irq = of_property_read_bool(np, + madc->use_second_irq = device_property_read_bool(dev, "ti,system-uses-second-madc-irq"); madc->imr = madc->use_second_irq ? TWL4030_MADC_IMR2 : @@ -905,20 +906,18 @@ static void twl4030_madc_remove(struct platform_device *pdev) regulator_disable(madc->usb3v1); } -#ifdef CONFIG_OF static const struct of_device_id twl_madc_of_match[] = { { .compatible = "ti,twl4030-madc", }, - { }, + { } }; MODULE_DEVICE_TABLE(of, twl_madc_of_match); -#endif static struct platform_driver twl4030_madc_driver = { .probe = twl4030_madc_probe, .remove_new = twl4030_madc_remove, .driver = { .name = "twl4030_madc", - .of_match_table = of_match_ptr(twl_madc_of_match), + .of_match_table = twl_madc_of_match, }, };