From nobody Thu Apr 2 09:34:03 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 399CC3E9F8E for ; Fri, 27 Feb 2026 06:17:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772173042; cv=none; b=kUGCSk1hN8nDuCY+tiNllc/mf1J6tBd5AWzHZ7+UFuELmGtgIqUv+BW6XefUdgzlYaSeO1MWJw5XIG2KKht2KN7osxcmw0x3K7Zvp/GNZr3mQbWR9D8xCtqMMQ237P8YgWlPRKtVoANU8GMZCgeantKIiXC+Pa8BxFpdKswXZ8s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772173042; c=relaxed/simple; bh=eY2I5uRUIiwUluElxUUOpi5fOiYU296aE/AH3jfENzs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dBIhZivZpfBGPyGjmI4UPKnhzGA6rSTloJRhQf1VtmSjGj6QVlRNb2Z5c3LUphj1Ip+lRl9JfUcMhvS8J3CEH1unI9se36tKKaSUxCph3etQJW2kiHk0GRxdqqi6b87QXzOCsZ4lglqjQKiIlHrD5Qc4FPcQYblRn/nLy6OzL/k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=OHTaXLAY; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=BUvvTGhB; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="OHTaXLAY"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="BUvvTGhB" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61R2JutZ3746986 for ; Fri, 27 Feb 2026 06:17:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=a6YJVRJhruA 6Q8Cy2OP0sNlAp+tW66kxMwSkhyUa0XA=; b=OHTaXLAYGCw4TlT9JNPjCwTZUmS 0Se1rvqUyRGyZXIejWcarn7hUF45jXoXS9ZArc86V2pxXc/fEFTQTT9hXXi/2CRA 2+2kp8Ve5CiEzxmgj6ea1lxBSy7PcTG6yz0AKmPJVV/uBIJHdkEjivrm6OBpmn9a pcZkJIYe19Z6BHEOohsjaJYIAJeMOpouK40SxDP/e+pCRdHVE3u55h3sKYDDYYOz ON/fOV6ws19TIYnR7HwUxdw0f8kHhulXrpFx2zyuoEK5K7LdFV6Xu4h+hLMjVbJS ulUJmkGS0ZMEQrlC4BiWlpPpXLWK029g0IVSkZQ4B3FBtl95R4C/IMuRRUw== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cjuur1ttm-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 27 Feb 2026 06:17:19 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2aaeafeadbcso18024745ad.1 for ; Thu, 26 Feb 2026 22:17:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772173039; x=1772777839; 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=a6YJVRJhruA6Q8Cy2OP0sNlAp+tW66kxMwSkhyUa0XA=; b=BUvvTGhBrB5ycz3CbI3M3ZiSDGNl7lxUc9cJIw8zR1Zc5t2WFsWm2h1D3EdV3Fz7O8 E6j9Lkvvo7Z/G0szbN/WKGhxi90eygxa9DoJIev+THowtkTvbCb5EXgSIMjDYgYp7+9k cU5LKkMICLCgOz8TsFnuL01pMHYGLj1hipnhCWY02wcCZnl9iuE5QtAmniHIAXR+Ib6k GzuMX1tGQwseqsyHmprx83EXczDE4bZSawGPMCil3gbsn5i0fnmtyNYGT+wlZArtylXs lS043eeCauQRYXED0DCHvkgJFUjUdq50W8x3OZh5lg4/Y8EjRRCbO9umNJY341q03fGj 9j3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772173039; x=1772777839; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=a6YJVRJhruA6Q8Cy2OP0sNlAp+tW66kxMwSkhyUa0XA=; b=pKFn8+ZkvyIbjkq0LRdRhTrwpAmbCl3KL9RlIELysOnjH02oYGwKaW+ZZC1NlmlWw0 DjAi8yHSRz3tv2XoFX9cFWWs2IaQ/zV2v3CC9hcd39ykyknuRvf/vixw8GhZXilNi2rK iEUeWZJM/GtzfBiapCzU0RLavxpBEFPdFwdC86LmUznMI+1aQANPXgjLdnVTODw+7rre a7TxBA7Gy2szMTxUGqYyYCCIOJZHCpoxUZYh57BOwlE4zIubfnF+LctAPRrKJlS3G/LS GLJLbVNWeUTOp4OFj1U5kWKevMLSY7Dxk8zPL9g5LoKPcZDl1NegUAXd1rgxowWoUL7c CuTQ== X-Forwarded-Encrypted: i=1; AJvYcCXzw5wKn7K0jQBqy4ZGPvbMM1MWcWGACrfqkSoN1RMiHm6WGmhhTshPSLlydN1RI2+o1JcirfeviiZ90dE=@vger.kernel.org X-Gm-Message-State: AOJu0YyeREYKA4mHEFcqfCguUU+PB6EwtYXtDUMMtIYmub+psQEIoMiS fDYo6sxB98dYnPq7rXCl5PpG8jiHhUEYLlPmQhcwfEIe9+lAc1epPy5/ViiNinr/IxqnH+ljtnf zPoUnAC4BUTn0c1Gtq8XMXZD0wP4elAuPQmuK4z8cTNa17lB9/5DKSiJNnLCU3KxBxnw= X-Gm-Gg: ATEYQzw5+NrTExJFyapS2t2dxm6sV5tbhzwa1Logd9+VDDApkhIjzHtAyGgAGaWNJ5b V2Iu0GIRSHMrjAsx9hivnRiRJ/yav/NS+YaRCzXX7qHeeoY8tAV6uJSqFr+Ky/rK+vhW705Zn89 ORIhUCwx6VBjxr2c1AEbZ5EQl6xWiKQZFMh+a6YOzQaTZqzjgJPLUWPE0MoaBD1/dcJFX8wpZHy qvtZcvqFqTFcDmVNTfTdXWgaqfNtyyEZnJ4vUv4Win/OLOmh8wSVl3SNpbTjjwjBKldrePynS8r QnL6N7RYolByKi4cvDvRjYAnvAXlnxsy8SnPs+x2I2F6hLZ+kvBS4OVpmspIrqAYWJKK7IqjpK6 kOFOM3kIHUnVkHc0wj6T5A95TvOI/P/pOHEUHU6dgC5CoC1p6YzWwmPI= X-Received: by 2002:a17:902:d484:b0:2ad:ba04:40cd with SMTP id d9443c01a7336-2ae2e40faccmr14904545ad.22.1772173038782; Thu, 26 Feb 2026 22:17:18 -0800 (PST) X-Received: by 2002:a17:902:d484:b0:2ad:ba04:40cd with SMTP id d9443c01a7336-2ae2e40faccmr14904245ad.22.1772173038179; Thu, 26 Feb 2026 22:17:18 -0800 (PST) Received: from hu-ptalari-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2adfb6a043dsm64813025ad.54.2026.02.26.22.17.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 22:17:17 -0800 (PST) From: Praveen Talari To: Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Mukesh Kumar Savaliya , Viken Dadhaniya , Bjorn Andersson , Konrad Dybcio , Praveen Talari , linux-arm-msm@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, bjorn.andersson@oss.qualcomm.com, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com Cc: prasad.sodagudi@oss.qualcomm.com, aniket.randive@oss.qualcomm.com, chandana.chiluveru@oss.qualcomm.com, jyothi.seerapu@oss.qualcomm.com, chiluka.harish@oss.qualcomm.com Subject: [PATCH v6 12/13] i2c: qcom-geni: Store of_device_id data in driver private struct Date: Fri, 27 Feb 2026 11:45:43 +0530 Message-Id: <20260227061544.1785978-13-praveen.talari@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260227061544.1785978-1-praveen.talari@oss.qualcomm.com> References: <20260227061544.1785978-1-praveen.talari@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: qwC84vR0XcB06vQcsO3kQDPfS5wksAjd X-Authority-Analysis: v=2.4 cv=PN8COPqC c=1 sm=1 tr=0 ts=69a136f0 cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=L-JS82rCYefCJmJZhRoA:9 a=uG9DUKGECoFWVXl0Dc02:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjI3MDA1MCBTYWx0ZWRfXy0q8JZRuYtzH e2eWKmr/he+AiXeTGrAXoSUrjWQYds3CY+CwbetjlVmi6yeyW9+MqHFPTAGmTiTjM6A4fuUiX2A YHklvWmWfOHiJrX9sJwn5kB1sRUqRCfOZjVAsNCsXm4g6UVlVXY3NYiQW+R9B7xsbDTEljnJT2O 9eQygKBGiE//j7shknh7KZXcAdxTqZThP16jQcrUKHgqE3pTLbJF0l01Kh6n4SxpP9E4JpCdBBh s6E4oitRSONSKf/xyQPu6cA8mwvSqRilTuF0xdOhk8pVLK71H6CqhUy3ui6CAexRbegEqdizpgp fXxDxQeBUkVkQ5CioJ8n7ITTjIlTV5o6YO77QH+mOu5Hq6WfMLvrHlWjedogUOJk5vUEGUj7Try sdAxqzDGFuHBotU01BoQHj3f2MislPhvd0KiaCRXYVOmG96fa0vwP10/Lz1W6vSELu7pGcGpr0y EN29k6jzCUKEA/51W+Q== X-Proofpoint-ORIG-GUID: qwC84vR0XcB06vQcsO3kQDPfS5wksAjd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-27_01,2026-02-26_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 clxscore=1015 lowpriorityscore=0 adultscore=0 spamscore=0 phishscore=0 suspectscore=0 bulkscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602270050 Content-Type: text/plain; charset="utf-8" To avoid repeatedly fetching and checking platform data across various functions, store the struct of_device_id data directly in the i2c private structure. This change enhances code maintainability and reduces redundancy. Acked-by: Viken Dadhaniya Signed-off-by: Praveen Talari Reviewed-by: Konrad Dybcio --- v5->v6 Konrad - Updated in geni_i2c_acpi_match() as suggested - Moved geni_i2c_acpi_match below to avoid errors of geni-i2c v4->v5 Konrad - Added a null check after platform data struct. v3->v4 - Added Acked-by tag. Konrad - Removed icc_ddr from platfrom data struct --- drivers/i2c/busses/i2c-qcom-geni.c | 46 ++++++++++++++++-------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qc= om-geni.c index 0ea4abbcd170..f2508038c64c 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -77,6 +77,11 @@ enum geni_i2c_err_code { #define XFER_TIMEOUT HZ #define RST_TIMEOUT HZ =20 +struct geni_i2c_desc { + bool no_dma_support; + unsigned int tx_fifo_depth; +}; + #define QCOM_I2C_MIN_NUM_OF_MSGS_MULTI_DESC 2 =20 /** @@ -121,11 +126,7 @@ struct geni_i2c_dev { bool is_tx_multi_desc_xfer; u32 num_msgs; struct geni_i2c_gpi_multi_desc_xfer i2c_multi_desc_config; -}; - -struct geni_i2c_desc { - bool no_dma_support; - unsigned int tx_fifo_depth; + const struct geni_i2c_desc *dev_data; }; =20 struct geni_i2c_err_log { @@ -928,15 +929,6 @@ static const struct i2c_algorithm geni_i2c_algo =3D { .functionality =3D geni_i2c_func, }; =20 -#ifdef CONFIG_ACPI -static const struct acpi_device_id geni_i2c_acpi_match[] =3D { - { "QCOM0220"}, - { "QCOM0411" }, - { } -}; -MODULE_DEVICE_TABLE(acpi, geni_i2c_acpi_match); -#endif - static void release_gpi_dma(struct geni_i2c_dev *gi2c) { if (gi2c->rx_c) @@ -976,7 +968,6 @@ static int setup_gpi_dma(struct geni_i2c_dev *gi2c) =20 static int geni_i2c_init(struct geni_i2c_dev *gi2c) { - const struct geni_i2c_desc *desc =3D NULL; u32 proto, tx_depth; bool fifo_disable; int ret; @@ -999,8 +990,7 @@ static int geni_i2c_init(struct geni_i2c_dev *gi2c) goto err; } =20 - desc =3D device_get_match_data(gi2c->se.dev); - if (desc && desc->no_dma_support) { + if (gi2c->dev_data->no_dma_support) { fifo_disable =3D false; gi2c->no_dma =3D true; } else { @@ -1020,8 +1010,8 @@ static int geni_i2c_init(struct geni_i2c_dev *gi2c) tx_depth =3D geni_se_get_tx_fifo_depth(&gi2c->se); =20 /* I2C Master Hub Serial Elements doesn't have the HW_PARAM_0 register */ - if (!tx_depth && desc) - tx_depth =3D desc->tx_fifo_depth; + if (!tx_depth && gi2c->se.core_clk) + tx_depth =3D gi2c->dev_data->tx_fifo_depth; =20 if (!tx_depth) { ret =3D dev_err_probe(gi2c->se.dev, -EINVAL, @@ -1064,7 +1054,6 @@ static int geni_i2c_probe(struct platform_device *pde= v) struct geni_i2c_dev *gi2c; int ret; struct device *dev =3D &pdev->dev; - const struct geni_i2c_desc *desc =3D NULL; =20 gi2c =3D devm_kzalloc(dev, sizeof(*gi2c), GFP_KERNEL); if (!gi2c) @@ -1076,7 +1065,9 @@ static int geni_i2c_probe(struct platform_device *pde= v) if (IS_ERR(gi2c->se.base)) return PTR_ERR(gi2c->se.base); =20 - desc =3D device_get_match_data(&pdev->dev); + gi2c->dev_data =3D device_get_match_data(&pdev->dev); + if (!gi2c->dev_data) + return -EINVAL; =20 ret =3D device_property_read_u32(dev, "clock-frequency", &gi2c->clk_freq_out); @@ -1215,13 +1206,24 @@ static const struct dev_pm_ops geni_i2c_pm_ops =3D { NULL) }; =20 +static const struct geni_i2c_desc geni_i2c =3D {}; + static const struct geni_i2c_desc i2c_master_hub =3D { .no_dma_support =3D true, .tx_fifo_depth =3D 16, }; =20 +#ifdef CONFIG_ACPI +static const struct acpi_device_id geni_i2c_acpi_match[] =3D { + { "QCOM0220", (kernel_ulong_t)&geni_i2c}, + { "QCOM0411", (kernel_ulong_t)&geni_i2c}, + { } +}; +MODULE_DEVICE_TABLE(acpi, geni_i2c_acpi_match); +#endif + static const struct of_device_id geni_i2c_dt_match[] =3D { - { .compatible =3D "qcom,geni-i2c" }, + { .compatible =3D "qcom,geni-i2c", .data =3D &geni_i2c }, { .compatible =3D "qcom,geni-i2c-master-hub", .data =3D &i2c_master_hub }, {} }; --=20 2.34.1