[v1,1/1] pinctrl: intel: Refactor intel_pinctrl_get_soc_data()

Message ID 20231030155906.3492801-1-andriy.shevchenko@linux.intel.com
State New
Headers
Series [v1,1/1] pinctrl: intel: Refactor intel_pinctrl_get_soc_data() |

Commit Message

Andy Shevchenko Oct. 30, 2023, 3:59 p.m. UTC
  Refactor intel_pinctrl_get_soc_data() to drop initial assignment
of the data variable. It's only used in ACPI case and instead
we may always assign it there as the ACPI ID table has the terminator
entry that has driver data set to NULL.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/intel/pinctrl-intel.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
  

Comments

Mika Westerberg Nov. 1, 2023, 6:36 a.m. UTC | #1
On Mon, Oct 30, 2023 at 05:59:06PM +0200, Andy Shevchenko wrote:
> Refactor intel_pinctrl_get_soc_data() to drop initial assignment
> of the data variable. It's only used in ACPI case and instead
> we may always assign it there as the ACPI ID table has the terminator
> entry that has driver data set to NULL.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
  
Andy Shevchenko Nov. 13, 2023, 11:55 a.m. UTC | #2
On Wed, Nov 01, 2023 at 08:36:43AM +0200, Mika Westerberg wrote:
> On Mon, Oct 30, 2023 at 05:59:06PM +0200, Andy Shevchenko wrote:
> > Refactor intel_pinctrl_get_soc_data() to drop initial assignment
> > of the data variable. It's only used in ACPI case and instead
> > we may always assign it there as the ACPI ID table has the terminator
> > entry that has driver data set to NULL.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Pushed to my review and testing queue, thanks!
  

Patch

diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 9b78e112fe60..3e8010607d32 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -1660,7 +1660,7 @@  EXPORT_SYMBOL_NS_GPL(intel_pinctrl_probe_by_uid, PINCTRL_INTEL);
 const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct platform_device *pdev)
 {
 	const struct intel_pinctrl_soc_data * const *table;
-	const struct intel_pinctrl_soc_data *data = NULL;
+	const struct intel_pinctrl_soc_data *data;
 	struct device *dev = &pdev->dev;
 
 	table = device_get_match_data(dev);
@@ -1669,11 +1669,10 @@  const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct platform_
 		unsigned int i;
 
 		for (i = 0; table[i]; i++) {
-			if (acpi_dev_uid_match(adev, table[i]->uid)) {
-				data = table[i];
+			if (acpi_dev_uid_match(adev, table[i]->uid))
 				break;
-			}
 		}
+		data = table[i];
 	} else {
 		const struct platform_device_id *id;