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: 13903318 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 81442E7717D for ; Wed, 11 Dec 2024 10:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=yGdG+efFlKJMGy1hO60aHqPfOfKK+2Rh3T+XWLFQ1f4=; b=191+tnP9Lmbodkhd6FL3VKNP53 mZHZ0k0B/ZHuFNWBs+juupdP46hoD7A5p0MT6MiCaOMqLQbx1VtPFkwKfTss9/AMxNaDI7v6AhWGN /KkE70NtfmAA0FnGpKFDDe9MoYSGdYC7FtDVc4slmnnDL8vtWeuxiCbTDfNYtH9RNwpKQ6sEwHEwf DAWZZqR40aHhvvjHt5Azmya4rYKXgs2W6BSPNK5nnzRbhFZinmxyHpB5sSdpbef7HiWORk71npE9j bg/ZyOsIdGJBd6Ybv5Bo92erlXpRhUlm/loIojOClS5s1XSJEgG6SIy27q+j5V/lBblvL9S0h2pDF 82h0aKkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLJyY-0000000Ea4C-0Kbl; Wed, 11 Dec 2024 10:29:50 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLJsi-0000000EZCY-0umr for linux-arm-kernel@lists.infradead.org; Wed, 11 Dec 2024 10:23:49 +0000 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-385d7f19f20so3089423f8f.1 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=lists.infradead.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=SOI+WUKF0Fb4P9wbDaFX4UPSoravsAHjhkVn3ORCBLFBJL3Msz3+30Iwh195GnVfLB ZABRFyrX2lyV437GcJ9Iq4R1gkdU5GDvlxEvAzQ27TXgiH8Me5nnZhmXNLF3HLvxR9OX 2r3uVT7pfzDs6+yRzfMyba410siZden3iFLeAuWBGMfZjTtVm0yQh2uN6uhb3ZvapaCx LZ0Jf2QGuXSyeaKPp79qJsyjpr7/GKbvbCYSckiIxOOb7PiAnVNmEKy48WbWnICecJf8 LuNlWJCtJU9ganFNXhJvX7T7VMRJMLDnmDiyT0gj7qHX7VAVMl/+33kD74T6Iw5nMs48 OGeQ== 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=whp+YQonsQPTPgu+mWH2gyy+E/DBFkDUpjxADaam8N+VD5mQxBg2Lpkg/3AqG82QT1 9HtIsn501px0qd/K65AMzvmj1Peo5/iVRKIYP7CP19zqtSfXi2uNCjS5mV91RpRwEW/U w53RrLt4yDoZ+5gWNce7Fu42AFEsK3xKClTPrXrtTBgSun7ONtNO8dwoSM0SnM14wuX3 WG5Y0OKg39icE7CkS4yBTSTlUVjy4mEy9ZE1XXddO03qY1FRbYUeN17eMeJgbUlxex8z ePnQN8008rHf7cUllzTN4o/WhLYQo3Tu0s9GwMoX3mOueYnftwfwc61ZmDsPPfkGfP7D GKGA== X-Gm-Message-State: AOJu0YwNZHGptxmflNpkxvxa2KfwdFC3k4HAaKJooGQG4XbF1NA7oq6D thc827g6DPjr9JOTDQtmTFx8M2YfeE/7pb7PrBkg6D+ATha9q50FR6l3tvsfke8UcGVTz38uGsO + X-Gm-Gg: ASbGncsW4WOpCtbhAsJVwWqfEOy9Va4hiy9Tq1CcPQ8A/0ZwB7s+FW/mXIINKRU/Xor plnASeIm13NvY51yxf5gaxgJFTognMA9ZjHIMsGURxeZIQWfqYHAPsEym9blx3Pl1F+h9+0Vumu TalE/MofjfzvY4HDYnsZHssuzlwzjedYsdElrOrCEZ/2sf7FcqbmDkXl28eJqC6583dkMkZJtoJ WVmDnpkM7or6VT1w3kr4O5zZWiBrKg74Ac7ADt7LcU/H1EX+2IVmA== 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 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_022348_527573_28F0123D X-CRM114-Status: GOOD ( 28.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13903319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8C17E7717D for ; Wed, 11 Dec 2024 10:31:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZTKqCe2SELpX+WlhYxUqap5glecVBp4pq97MmKxgypE=; b=I42l7cIOQY48tZ8NvLwcXHDUbo M96A2ujWlLoX09fDo6Er0Tyegh5mUYVlNlKXKxLZ5KdeqEBC8zNCmqq7vxIf3vd1rD8YafoUmqXIh 7ujZfYYyi7yalPdCvr9fN18X0Tvm5LLsuoEitZk52yHBpVEfjofhqEzPUjvGw/2pFjJO1AHZGXx5i OSKr0ZoIzaRHZ2E0G8nQKPdJyS4wUKQ4UKR0PJvubore3kXM0EuW7QZPmG4wtsZZDnMDyzADm3LUX zorXl4AW6U/gV20wKdMO7OEgs4rZnvS8m7la4FKhBFnj7z+yC0vb7vu6TaYzXn01Zf6LMgcjFk4nt JvX+E8Jw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLJzZ-0000000EaBO-2pqc; Wed, 11 Dec 2024 10:30:53 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLJsj-0000000EZCd-03DV for linux-arm-kernel@lists.infradead.org; Wed, 11 Dec 2024 10:23:50 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-38632b8ae71so3140432f8f.0 for ; Wed, 11 Dec 2024 02:23:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1733912627; x=1734517427; darn=lists.infradead.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=ZTKqCe2SELpX+WlhYxUqap5glecVBp4pq97MmKxgypE=; b=rkZolzyoW2q35bnu0SVcKywnilJNvVf/tOKj4hg7fb+StNJKwN6aPFg3A7s6P/MfXf aR+lnI6l9L9VFugFLWqdT6yBUTEhGAmXVZNUyxtIYoZAbYmWI1aC0bNgdhmJf3dywVy3 IuDtp73gDJDBT9S/wwESmjCB4KPz/YK7TU1LlP0g4A/RaYmy24cB+bYL3FBkVhgYjyon yh+jWSKdnfrjo/710IGdaAJXmrtZNnCYB4V2lk8P23G522hIjWJnoshM7JH2B+QWGRDw ivWD0urRheqhcXz4MpviDQwjdqL1X3NjlGoxN0vwi/d3Xu/hyHIaXLLRMmMs5l/ERi3L 42xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733912627; x=1734517427; 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=ZTKqCe2SELpX+WlhYxUqap5glecVBp4pq97MmKxgypE=; b=IllwLvf1ld2QfBq7URM//ptuWsyR8t1yN0t8ehz4XjZTRTd1rV1G2bbuvn0dXFpUEn QfThGE7mP75vIjIj2DWXWIvzjU4n/147tSXN9e3PE/BEMzFR/V+iu2z87dtNru0zrUhe 4M+8SVWSMqJGzSZ8m8QZm21Oliter5NKQAyyVNpzBDOAVsB9zXJJ0zrSDTzSkZJFnh5w aTBOWF6NG7Ax7INLr6KxBBorXPMJbjTcu93QQMJLhYu2cLMR+zbzKpWjabeMw73Z5aqi m8B74FZIAIQPNXyEBRgVRy7zcOiL2MYBQXZXDbkZRUhD1YpQNc/ZGOnyBgTKfY3FxxqP CH6Q== X-Gm-Message-State: AOJu0YxCVfIthdgQ9Vt4napj3pgoiVO2xo4O3E+TNgOJHdsWUAFpfnFw KnMNmESB2MrKjgbV7ThPDuTAfp2mKdVhge1IJcgntCngJyABIs269HA8ab6kdW4= X-Gm-Gg: ASbGncvqkyCUopcfzRJznpmhw1lC6ZEHSylDCdrJxT5qG8mk6+U8cCL1kIJqOw0vQa0 mNBgPOg7Cnsnl3yNFhhDfs74YjqywgMjVx6yYS30VW1kgldjO+zDdUcrI+ntYBHSBeDPH/omjev Qud9LBbFCOhbcoKfoP9EZMYrNql0PCfKfXM46iRKXWR8VxBVrG3EINvzXMnpKrs/pq4jO9lTJiK x1n+pk5QR5fL3Hi/9DFkxXrrgl0bke1jINFqMXnxec+OOSozg5RFg== X-Google-Smtp-Source: AGHT+IGb04BT249VC+YXzPYDilPJen43l7hFegMSZVIrm1PY3iqvihpx9mzJpwggyt25syAnQKuRgA== X-Received: by 2002:a5d:64e8:0:b0:385:fc70:7eb with SMTP id ffacd0b85a97d-3864ce7fe09mr1468743f8f.12.1733912627500; Wed, 11 Dec 2024 02:23:47 -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.46 (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 2/3] i2c: davinci: order includes alphabetically Date: Wed, 11 Dec 2024 11:23:36 +0100 Message-ID: <20241211102337.37956-2-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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_022349_050565_67C775AB X-CRM114-Status: UNSURE ( 9.07 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Bartosz Golaszewski For better readability order included headers alphabetically. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andi Shyti --- drivers/i2c/busses/i2c-davinci.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 4b499931fdfd..bab9f785eeec 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -11,22 +11,23 @@ * * ---------------------------------------------------------------------------- */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include #include +#include +#include /* ----- global defines ----------------------------------------------- */ 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: 13903320 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD568E7717D for ; Wed, 11 Dec 2024 10:32:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UoYTxKIN+xa5B1OH/ejn5xfQpSaxCFnsi2/bPSTrz2Y=; b=Wp9MNd1oDb4hOBKhabXFk/JXxz p7+n41Kik4YncBwgGhj6QF1BepfOguh/6ZwuLipPXxAy0DozD+tcjQWe3is0O8RgOb/CY1eqYeeYP /82qNm/WRIZ2yySCRPeNXQ5mleT4EcQaKD7Aqgge2TGrij0fw26YDDNOHxH4wAc5IjWZnFa2etHjc xGWtvgXgJns1nHM31cX6yVZa7YlsXjriSi8zH++u1EKBnM7Hd14ZiyMvDnrET9SvB8EhjpbXC12Ia WYOmWYorYCbcC+CEhaqlqVlQH4CdGYIgdXK7qRxkeCC3Wfr6nHEPWFpC+2cZ9KwBgpQQ9PsOVbuxu Ctg3aTvg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLK0b-0000000EaJc-15zb; Wed, 11 Dec 2024 10:31:57 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLJsk-0000000EZD9-2ioh for linux-arm-kernel@lists.infradead.org; Wed, 11 Dec 2024 10:23:51 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-434f80457a4so2855835e9.0 for ; Wed, 11 Dec 2024 02:23:49 -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=lists.infradead.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=E3okqYcQNllK1Vu2pK5NbTrvJ5MCgb3LiXnbe4PL0FB7Z8RDsmVvNNghdeLxEJrYel L+oLj9M2mHJl3OgMPHqCueGS96SR2II7KM1LyoG0EM2uCV11LGj7meqQ0RWI8QZxnxHa aHRSDlj85FbAoGttAWouYsfxSTRpJKTg7h1XL61Q+3KI/9trbF0QUqthYnQlvvyVh+0/ gBwnyhTTmIVeioHw7+0t4ZGUsmT1YGhC+Bd00yNTif79hprdAXGrxSYHjjRdw+er+7Y/ 3u9qJgnGBoq/H48xKx4fvcDa9BbEBHvFnWPlQeQUfkFd2ezpcXvfNfeOphLnbrTRh9sH V3RQ== 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=jGKIKbVJvjsmmw9m5k6n2lo/g6mxSCh+xSxnzHajTNISzxnCP62oP7s2nr4/4GMCMB J0Vg8G17BcPGH82NeXZirCsiVDTCDXr2lS3p3wM81js0JL9FX8Ok/Zl+lO3hcb+8k1UL R+qz9Lqmaf8j3Jy866s8jidRneGHU+27/PH4thiL67CxYb4rH5E5n7R5jXTFQMuBym8p orFcjhK8vD+zzmcA/lYA/yZN0Jur39ibwwlI+1QuGyU5N2fr3eJHpnhXvI2RqrDb1PZn sH749chzVpm2a6bpDkQtJb6Kpb9AEHYTqrQKCGmq4vthC9c8D+sArrq85UAOxMqZVFBZ 2d3w== X-Gm-Message-State: AOJu0YxD9y+ruVPRjnr3gdCpkMeLmRkkpnyx3pohvDaQ6ATTjYwgpQTL U2kKjUegdFN5oy+CajOIcX04nEhDbPW8Iffj3K4cJ6eH+yccXA3tq6QDZedDbbaxOqII+/NEOK+ 6 X-Gm-Gg: ASbGncuyb2ecK0wHUGozUfOMkDnRNbruLP2BKiaJLrz0dAhqBhLA4SXYY8GQYDmMwnY 2XvILhwDw4+iLjd0HRRfhy42NUtsQ8mcQIcI71LOSGMMWznlUzwbbTV11zX8RxRHXBznj4772B1 KGdeeKGO7hXK1k7lptvxm9hS0ONfuCvwaELmVrnPngu960QvEvdEC4fcqfy4b7le+wkrKV0v9yO LiNI7MeWu/o8po3kwOgSJCMpz7DAaax5Uw1nlFjtyczYm4P9smY5A== 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_022350_684755_56AF5F11 X-CRM114-Status: GOOD ( 12.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Bartosz Golaszewski Don't use generic OF APIs if the generic device-level ones will do. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andi Shyti --- 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;