Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp2032502lqg; Mon, 4 Mar 2024 10:40:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU4jsISSD7FAjwvihQZw8oGB1jHVlqIa5OvqAFa1YupXVg5VMpHOWLJhV2jWiuHucEBRboApCyMjpMjjd74DTT/KWsXdLnPpjT4NYRZVQ== X-Google-Smtp-Source: AGHT+IFHJ9N5QEhCWyKzU3uFCFji5QId5ERt/zZWkkgD44DtJH/Ew6zsXEF4Ox3ndWVN3lPn20jb X-Received: by 2002:a05:6358:7e86:b0:17b:304f:b3d with SMTP id o6-20020a0563587e8600b0017b304f0b3dmr11016333rwn.23.1709577650665; Mon, 04 Mar 2024 10:40:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709577650; cv=pass; d=google.com; s=arc-20160816; b=xm5Sm6YWCbuuqW6YU+cbhoakLHjvTAkMWYr3ZpSg5vYxLCGhHFT+oELR++lzKsSO1b 4fxmlxin/TnDuEPWXMSm7DANzRc4jhNhNVu7jeshqyIcoTa9OfCs7lMVBFRRVpygmc6o RC1jiYn0Bst8zInJgM+T6DUu34Du4XV+U8FEyp46ls0cKFmuWgx4lLoQnNSTjOGJoxcn 7rroGF+ZOPr95PXg9cSamXjT+wfbFezYYKmN+CZFbm8s74IudD8YXLJkG3iJZ2SHJaw5 mhI6o+GmfjZeA8JI+KGgJ+ANPlHZoo2lGXVy//gFrRLPeED0dDDn1zj3Ui2xtsBDtucD 9DYA== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90751-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id iw2-20020a0562140f2200b0068cd18be26bsi10379550qvb.117.2024.03.04.10.40.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 10:40:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90751-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90751-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 77E741C21B9E for ; Mon, 4 Mar 2024 14:41:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 20E7146542; Mon, 4 Mar 2024 14:40:46 +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 Content-Transfer-Encoding: 8bit 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, }, }; -- 2.43.0.rc1.1.gbec44491f096