From patchwork Wed Dec 11 10:23:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 849461 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AC1F1EC4D5 for ; Wed, 11 Dec 2024 10:23:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733912630; cv=none; b=uI+Ld45pCm4ME+w6NHUHoBGA3aXepIuSO8bMxEtyg6EeBc68Oxee99xfeyqiN5iw63ROlnvPDdGdCOArs2Vk6JfNqRMiHnUlFztQtdeF9NC0z36yG9FKuLGhm17v0PWXMwJWGiZWgrJ8LUTcFRuBCREC1wwVvZP6eCe/QVHLnnE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733912630; c=relaxed/simple; bh=gnKSCwyOAGPCAEWBe4y/CpbfgFG4Q/sT43EoaV7fA2M=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=o16C+E1DBbeduPGvdRi3w2ZqvWv83e/kX3t+Ufb5qPs0JYkYgRekM7umpjdTW0Rblvm0SMVtI83BOR65t5dMFPLgkOPn1l43+OG0Azbysg1Uw1ozR1+8XDJ9Vg6Vc4b2ZJYmdFVBMiqfSfyjPoCzNAcMOtJur2x97+FxYyRJZdE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=l5HKlv+Y; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="l5HKlv+Y" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-385e1fcb0e1so3543259f8f.2 for ; Wed, 11 Dec 2024 02:23:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1733912626; x=1734517426; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=yGdG+efFlKJMGy1hO60aHqPfOfKK+2Rh3T+XWLFQ1f4=; b=l5HKlv+YRQFlKCPtrGf0Z8jqvjRDBDWDOaKPrSi+FZY1hYUC+pSlVdaj8+WIqdAI1w feIOVjnSMHVD2q/f81NrYNn379XSDc/XPgGCyjd9QXRT5F1lx5J8E+pnLd/12R+TATQ7 g3AccY70QkZCyC331u+73fQVCcZ5McblMe6TDB9IPGmwYynzIuJ+XFG4449r9IOo3KLP 8s51nWqLUEiXNWsiRzgWwMJdLw2yGkBwgZYgcnCy9BQaaIaNTgB1fE9Jgj6N8hlqxUML +DPcI3VsJcKg6a1DrxvMJJDc9LShZWsCOuoFDS/ctexz3ruhMe6ZjTxh4+a4Uuv6M9wz A9zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733912626; x=1734517426; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yGdG+efFlKJMGy1hO60aHqPfOfKK+2Rh3T+XWLFQ1f4=; b=Roz+I3uIeau2ibcmPbqK898SzaY5FnDtnnBl5z36g7IJ4rHHmgCo/PWnFHBTQWOHR1 WtfK1rmFSXOdXyML+2BVF8OVeAaseQVDHl8wFWUQTyhBQKSwySRi8Zj8RwvV/tu779O1 jjOMDtO5VuMH0MwCzwzsWGth+0we47YEBJbwjUA9HTNXzZlEwGm/yQosAfJUBd5eaHr2 RCpT5+ZH1gtWyKSqjBxPQEK/VWgaHps/ADaoznS8QwAom4mDttzY60zcKvSzY/A6LrjL Uz2vAelXdl6c09MsbIdFrviXAsVkUqKeZmxL1k7i8JrZd/PFwUtxkYd04qnwPtQ2Iju+ wsNw== X-Forwarded-Encrypted: i=1; AJvYcCWND231SiKpyxlfvqVjEuzgrjEeFpTyzgXPTJtpY3zkcKjV4bve2NpOMF5+t6qa10bmzKmKYxoiXtQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzZPVP0R24bOOObH6CIcIPXHsm9vr7jZjCFSHM+18PfZ6kk85ek SnHDc8kTY7TpTmVb+pbZt/U02FrVkVejOpFzaptHLUD+aZlykMA04E/hsfiJ7gU= X-Gm-Gg: ASbGnctskpnxoMTxsiXiyWzpqIa4xAw7o6DGPbMWxD9XmMMf/bQj7d4OV4vEpNHFvYk QldUJLhRpWBWegSYHc3w9EuT3eboHwUCgtYo9eLpUjsiGt3BKasU5SuAi79JE0RndhK6kYI+PFc yIZFjXlxl94IUD+rubvp+Joe/l9HugTfLxpRiNwNRxfyBymkLscXxQIP94VOwt0KyMSSq9azRlG CH4+tRUv6+fwrE0V1u1Rpt6d42SndezSd8m0m5P142Qfk2wR1nRsg== X-Google-Smtp-Source: AGHT+IFJ4gCMtzEcx7g0aluwVjcSbC3OL+f83awbEbuLNysR22JVH3W4l1pkbCQc573vAFsmTdpvPg== X-Received: by 2002:a5d:47ab:0:b0:382:31a1:8dc3 with SMTP id ffacd0b85a97d-3864cea566cmr2073298f8f.35.1733912626455; Wed, 11 Dec 2024 02:23:46 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:d1b3:c106:bf71:3b65]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38782514da2sm935137f8f.66.2024.12.11.02.23.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 02:23:46 -0800 (PST) From: Bartosz Golaszewski To: Andi Shyti , Wolfram Sang Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 1/3] i2c: davinci: kill platform data Date: Wed, 11 Dec 2024 11:23:35 +0100 Message-ID: <20241211102337.37956-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bartosz Golaszewski There are no more board file users of this driver. The platform data structure is only used internally. Two of the four fields it stores are not used at all anymore. Pull the remainder into the driver data struct and shrink code by removing parts that are now dead code. Signed-off-by: Bartosz Golaszewski --- drivers/i2c/busses/i2c-davinci.c | 80 +++++------------------ include/linux/platform_data/i2c-davinci.h | 26 -------- 2 files changed, 17 insertions(+), 89 deletions(-) delete mode 100644 include/linux/platform_data/i2c-davinci.h diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 71dc0a6688b7..4b499931fdfd 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -26,7 +26,6 @@ #include #include #include -#include #include /* ----- global defines ----------------------------------------------- */ @@ -117,6 +116,8 @@ /* timeout for pm runtime autosuspend */ #define DAVINCI_I2C_PM_TIMEOUT 1000 /* ms */ +#define DAVINCI_I2C_DEFAULT_BUS_FREQ 100 + struct davinci_i2c_dev { struct device *dev; void __iomem *base; @@ -132,13 +133,10 @@ struct davinci_i2c_dev { #ifdef CONFIG_CPU_FREQ struct notifier_block freq_transition; #endif - struct davinci_i2c_platform_data *pdata; -}; - -/* default platform data to use if not supplied in the platform_device */ -static struct davinci_i2c_platform_data davinci_i2c_platform_data_default = { - .bus_freq = 100, - .bus_delay = 0, + /* standard bus frequency (kHz) */ + unsigned int bus_freq; + /* Chip has a ICPFUNC register */ + bool has_pfunc; }; static inline void davinci_i2c_write_reg(struct davinci_i2c_dev *i2c_dev, @@ -168,7 +166,6 @@ static inline void davinci_i2c_reset_ctrl(struct davinci_i2c_dev *i2c_dev, static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev) { - struct davinci_i2c_platform_data *pdata = dev->pdata; u16 psc; u32 clk; u32 d; @@ -212,16 +209,16 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev) if (of_node && of_device_is_compatible(of_node, "ti,keystone-i2c")) d = 6; - clk = ((input_clock / (psc + 1)) / (pdata->bus_freq * 1000)); + clk = ((input_clock / (psc + 1)) / (dev->bus_freq * 1000)); /* Avoid driving the bus too fast because of rounding errors above */ - if (input_clock / (psc + 1) / clk > pdata->bus_freq * 1000) + if (input_clock / (psc + 1) / clk > dev->bus_freq * 1000) clk++; /* * According to I2C-BUS Spec 2.1, in FAST-MODE LOW period should be at * least 1.3uS, which is not the case with 50% duty cycle. Driving HIGH * to LOW ratio as 1 to 2 is more safe. */ - if (pdata->bus_freq > 100) + if (dev->bus_freq > 100) clkl = (clk << 1) / 3; else clkl = (clk >> 1); @@ -255,8 +252,6 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev) */ static int i2c_davinci_init(struct davinci_i2c_dev *dev) { - struct davinci_i2c_platform_data *pdata = dev->pdata; - /* put I2C into reset */ davinci_i2c_reset_ctrl(dev, 0); @@ -274,8 +269,7 @@ static int i2c_davinci_init(struct davinci_i2c_dev *dev) davinci_i2c_read_reg(dev, DAVINCI_I2C_CLKL_REG)); dev_dbg(dev->dev, "CLKH = %d\n", davinci_i2c_read_reg(dev, DAVINCI_I2C_CLKH_REG)); - dev_dbg(dev->dev, "bus_freq = %dkHz, bus_delay = %d\n", - pdata->bus_freq, pdata->bus_delay); + dev_dbg(dev->dev, "bus_freq = %dkHz\n", dev->bus_freq); /* Take the I2C module out of reset: */ @@ -309,12 +303,6 @@ static void davinci_i2c_unprepare_recovery(struct i2c_adapter *adap) i2c_davinci_init(dev); } -static struct i2c_bus_recovery_info davinci_i2c_gpio_recovery_info = { - .recover_bus = i2c_generic_scl_recovery, - .prepare_recovery = davinci_i2c_prepare_recovery, - .unprepare_recovery = davinci_i2c_unprepare_recovery, -}; - static void davinci_i2c_set_scl(struct i2c_adapter *adap, int val) { struct davinci_i2c_dev *dev = i2c_get_adapdata(adap); @@ -414,7 +402,6 @@ static int i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) { struct davinci_i2c_dev *dev = i2c_get_adapdata(adap); - struct davinci_i2c_platform_data *pdata = dev->pdata; u32 flag; u16 w; unsigned long time_left; @@ -424,10 +411,6 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) return -EADDRNOTAVAIL; } - /* Introduce a delay, required for some boards (e.g Davinci EVM) */ - if (pdata->bus_delay) - udelay(pdata->bus_delay); - /* set the target address */ davinci_i2c_write_reg(dev, DAVINCI_I2C_SAR_REG, msg->addr); @@ -758,8 +741,8 @@ static int davinci_i2c_probe(struct platform_device *pdev) { struct davinci_i2c_dev *dev; struct i2c_adapter *adap; - struct i2c_bus_recovery_info *rinfo; int r, irq; + u32 prop; irq = platform_get_irq(pdev, 0); if (irq < 0) @@ -773,29 +756,15 @@ static int davinci_i2c_probe(struct platform_device *pdev) dev->dev = &pdev->dev; dev->irq = irq; - dev->pdata = dev_get_platdata(&pdev->dev); platform_set_drvdata(pdev, dev); - if (!dev->pdata && pdev->dev.of_node) { - u32 prop; + r = device_property_read_u32(&pdev->dev, "clock-frequency", &prop); + if (r) + prop = DAVINCI_I2C_DEFAULT_BUS_FREQ; - dev->pdata = devm_kzalloc(&pdev->dev, - sizeof(struct davinci_i2c_platform_data), GFP_KERNEL); - if (!dev->pdata) - return -ENOMEM; + dev->bus_freq = prop / 1000; - memcpy(dev->pdata, &davinci_i2c_platform_data_default, - sizeof(struct davinci_i2c_platform_data)); - if (!of_property_read_u32(pdev->dev.of_node, "clock-frequency", - &prop)) - dev->pdata->bus_freq = prop / 1000; - - dev->pdata->has_pfunc = - of_property_read_bool(pdev->dev.of_node, - "ti,has-pfunc"); - } else if (!dev->pdata) { - dev->pdata = &davinci_i2c_platform_data_default; - } + dev->has_pfunc = device_property_present(&pdev->dev, "ti,has-pfunc"); dev->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(dev->clk)) @@ -843,23 +812,8 @@ static int davinci_i2c_probe(struct platform_device *pdev) adap->timeout = DAVINCI_I2C_TIMEOUT; adap->dev.of_node = pdev->dev.of_node; - if (dev->pdata->has_pfunc) + if (dev->has_pfunc) adap->bus_recovery_info = &davinci_i2c_scl_recovery_info; - else if (dev->pdata->gpio_recovery) { - rinfo = &davinci_i2c_gpio_recovery_info; - adap->bus_recovery_info = rinfo; - rinfo->scl_gpiod = devm_gpiod_get(&pdev->dev, "scl", - GPIOD_OUT_HIGH_OPEN_DRAIN); - if (IS_ERR(rinfo->scl_gpiod)) { - r = PTR_ERR(rinfo->scl_gpiod); - goto err_unuse_clocks; - } - rinfo->sda_gpiod = devm_gpiod_get(&pdev->dev, "sda", GPIOD_IN); - if (IS_ERR(rinfo->sda_gpiod)) { - r = PTR_ERR(rinfo->sda_gpiod); - goto err_unuse_clocks; - } - } adap->nr = pdev->id; r = i2c_add_numbered_adapter(adap); diff --git a/include/linux/platform_data/i2c-davinci.h b/include/linux/platform_data/i2c-davinci.h deleted file mode 100644 index 98967df07468..000000000000 --- a/include/linux/platform_data/i2c-davinci.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * DaVinci I2C controller platform_device info - * - * Author: Vladimir Barinov, MontaVista Software, Inc. - * - * 2007 (c) MontaVista Software, Inc. This file is licensed under - * the terms of the GNU General Public License version 2. This program - * is licensed "as is" without any warranty of any kind, whether express - * or implied. -*/ - -#ifndef __ASM_ARCH_I2C_H -#define __ASM_ARCH_I2C_H - -/* All frequencies are expressed in kHz */ -struct davinci_i2c_platform_data { - unsigned int bus_freq; /* standard bus frequency (kHz) */ - unsigned int bus_delay; /* post-transaction delay (usec) */ - bool gpio_recovery; /* Use GPIO recovery method */ - bool has_pfunc; /* Chip has a ICPFUNC register */ -}; - -/* for board setup code */ -void davinci_init_i2c(struct davinci_i2c_platform_data *); - -#endif /* __ASM_ARCH_I2C_H */ From patchwork Wed Dec 11 10:23:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 849460 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 430991EC4E8 for ; Wed, 11 Dec 2024 10:23:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733912632; cv=none; b=Qd0yJaOR2WKEMJ4F/5zmBWm3Y3gDp++E98pJ5vpRBT97fNBI6fnMGTN5RH6rds5iQA/8ZUrBlJ+qKc+FBasK4ZCqw7Ida58456X+KxlND8z4gYVYz6uE6CsWxkgfGPRDNqYG8lYBXT/CLFELDJ2esP6JMTNhyUESfAOEyDUJHkg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733912632; c=relaxed/simple; bh=AvkwhoWiBNLBQ0DMxqKzJFjYJd3orUN55tfFIIyDd00=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CAPCG0Lwd37me7s36Gfwf1MWUK4I1DsNj+9NnkPDO3OY86U76ipP7IkJy4DFt0RML4gglKr99MV5tzHbsgL3B+I43J/vetvVxoHaOJuQvajZh4M1JpzBjVYDxvvyWTSx/aStm0AtQNUZc6YHcwKraXogduQ2Nv/m9ojAe0nxKys= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=u2vOGOir; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="u2vOGOir" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4361b6f9faeso2934855e9.1 for ; Wed, 11 Dec 2024 02:23:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1733912628; x=1734517428; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UoYTxKIN+xa5B1OH/ejn5xfQpSaxCFnsi2/bPSTrz2Y=; b=u2vOGOirK819S0RuSFaLClgEbh7kJgUaQp1yNMrAef5O7rCRSRRnQRO3QFeNMB7BuS q0yoKwc6FuCIKXDUxVSTqQLov6gD17zYATWbiTwFr70Bt7M9MaWVwl/w0hYOG90foGqM HxqqB6fc2Z7kGQn0dE98K9BjVW4yMDLAZpYgMsGtDn4hth/xt/vBk69slj6nykH2IHDb kUEDiSK5r6N5lNX5pwvbBx4+V/ad8IKyD6W8AKgxJm0k05+3njbqlC+5YOGAtVvJDBn/ gBFWUHQAadL0+zwQQMnaPGA2Zh4kDgZSk9p3KFKPm5hWTqaiIZrr0QXVRQBIty0TGRRM BXvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733912628; x=1734517428; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UoYTxKIN+xa5B1OH/ejn5xfQpSaxCFnsi2/bPSTrz2Y=; b=Cqspm+Th7FDuXT7Kw7Aj8IWJf+9Wy124/H3bgmMFzNiJJAlClqn9/wIgV9Dge6kpCQ MahkekdG4SIv8/fRKRRmXG+yLtXEv34uvZATIMvwpTnZce/9M/xVuzDItcCB2hgvC/6I HVX8K18qmNnmOUCrUa0RlwDc5B2Tt3HJkFnfUsnYYoJOFcdwsxVw7UFZTyLDXlB9SMl9 ThRvoeXCMf8Eha1u4tKDyR59eXffKBSIiMxDuiFYYB5I3ZQLEr/YC/XVNrYcJUeDRHAo aUQ73pd0QwO+Tr0MJsMifDT+GxGqYqYcnj6zKRgGuZnuAOQXMdeWD4HyFPaqxnN+FXPe p4vw== X-Forwarded-Encrypted: i=1; AJvYcCU0We0b1DjgJ79fY+gQyNWcsklG+iZH6sflD1siS+kX1tlj6FN2vhagXQdgwcBDnr+YQQNkxkZUyug=@vger.kernel.org X-Gm-Message-State: AOJu0YzbPr+owwvsw8ISp0tFgeEx4RMcbb7QEAKbIzo1GDe74W2a+CLt MrcM94CdqiwCizG0tK9sv8HVTA8A1M7wZnBQH3it0oMgE0ykY8vek5VSrsXixTU= X-Gm-Gg: ASbGncu100ZdP08tOJaNncRKgsOZcX3Wf8A2hA/fsbR5wVgvUC5mwarZVF/dLWn6ydU jJ4hn1dvfzxKVuVx9PrtT71FahxsW3F6CBGFe0kn7j2kqm6uhIpmG+HgmGSXYIq51XKMVvFCpEt 1CojiHKkrgBokKMb/EsuBJ9HDe4h+1n39ABB7E7suMPjHVIEzknXBuLbNEpFNrCYh20TTPSmgZw 9wuwKZMoMjbYT34WuNcBFKjsQA77fISmlvBUeh0Odu9ozUrIhnUmw== X-Google-Smtp-Source: AGHT+IFbH76aSaMWfUWSLsltMf1aj67sgeQOV+1fX/o5OmT9HfAeHOm6psOWA85iumCSEI4DBs/c8Q== X-Received: by 2002:a05:600c:1511:b0:434:9ce6:3ec with SMTP id 5b1f17b1804b1-4361c5b1b37mr13444565e9.7.1733912628390; Wed, 11 Dec 2024 02:23:48 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:d1b3:c106:bf71:3b65]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38782514da2sm935137f8f.66.2024.12.11.02.23.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 02:23:47 -0800 (PST) From: Bartosz Golaszewski To: Andi Shyti , Wolfram Sang Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 3/3] i2c: davinci: use generic device property accessors Date: Wed, 11 Dec 2024 11:23:37 +0100 Message-ID: <20241211102337.37956-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241211102337.37956-1-brgl@bgdev.pl> References: <20241211102337.37956-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bartosz Golaszewski Don't use generic OF APIs if the generic device-level ones will do. Signed-off-by: Bartosz Golaszewski --- drivers/i2c/busses/i2c-davinci.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index bab9f785eeec..6a909d339681 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -23,9 +23,9 @@ #include #include #include -#include #include #include +#include #include #include @@ -173,7 +173,6 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev) u32 clkh; u32 clkl; u32 input_clock = clk_get_rate(dev->clk); - struct device_node *of_node = dev->dev->of_node; /* NOTE: I2C Clock divider programming info * As per I2C specs the following formulas provide prescaler @@ -207,7 +206,7 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev) psc++; /* better to run under spec than over */ d = (psc >= 2) ? 5 : 7 - psc; - if (of_node && of_device_is_compatible(of_node, "ti,keystone-i2c")) + if (device_is_compatible(dev->dev, "ti,keystone-i2c")) d = 6; clk = ((input_clock / (psc + 1)) / (dev->bus_freq * 1000)); @@ -811,7 +810,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) adap->algo = &i2c_davinci_algo; adap->dev.parent = &pdev->dev; adap->timeout = DAVINCI_I2C_TIMEOUT; - adap->dev.of_node = pdev->dev.of_node; + adap->dev.of_node = dev_of_node(&pdev->dev); if (dev->has_pfunc) adap->bus_recovery_info = &davinci_i2c_scl_recovery_info;