From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 AFA90518132; Wed, 30 Sep 2026 17:07:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790788039; cv=none; b=SkamPqzTjypkPEPwzBOxEYw4d2y2SaKZ3SDWSjcmvbU12iEnUkZjBF1arQALkBIH/7oiZPklM4ewkkTTkjYWgGBRZe7snqTJBAObzqtIb98mF0ejWR1VCW/8Fm91OGe1kQpUocNQqX7ZxAXowgelTwbeRoHA6hCObrUR40aV4UQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790788039; c=relaxed/simple; bh=UAkNlVWOO6JHX99UNEr2vu2rf6/DdkNFgFw6mLf7SMo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XREcHx2sdYiB6gon5EativxeM3yvrAQvpU8q9L/IYVOGX/+dQWWLGqUxh901qUo2G8fqojrppxyRnlD/q56lGlJh/lnoi/+enZkXkTlAGoHM6ZhFUZPY4ByU1lmZPjmCP8VbgFOkLa/NQXmrjaoHjrHKV9hObmBZl0PHYXuxUxU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Ak1CfX1c; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Ak1CfX1c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C73271F000FF; Wed, 30 Sep 2026 17:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790788038; bh=HXbbOc+RqI43iEUwb6tjpTRGiaTjCcb4ErdUjDufXOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ak1CfX1czkNPkcZgTyV5dbpgX3qUZLfqMEdRXZ4XuzePkHElizq3fgTdSrh1O+EuK YOKlyGgK6z5mUNhEeWRtJaUhEAM9l123yvbl9TtYfZcdJ2XzV5xStisGcCqfUnyYA1 GHbSbl3B8RBDXPJRpLryCLnm5w6rQX2unHEGR4Qg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Praveen Talari , Viken Dadhaniya , Konrad Dybcio , Mattijs Korpershoek , Andi Shyti , Sasha Levin Subject: [PATCH 7.2 440/457] i2c: qcom-geni: Store of_device_id data in driver private struct Date: Wed, 30 Sep 2026 17:29:05 +0200 Message-ID: <20260930152355.495276289@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152346.024115587@linuxfoundation.org> References: <20260930152346.024115587@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Praveen Talari [ Upstream commit 692e0c84db5fdd88c242eadc873d498787c94e3e ] 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. Signed-off-by: Praveen Talari Acked-by: Viken Dadhaniya Reviewed-by: Konrad Dybcio Tested-by: Mattijs Korpershoek Signed-off-by: Andi Shyti Link: https://lore.kernel.org/r/20260617-enable-i2c-on-sa8255p-v7-5-ad736dbeab57@oss.qualcomm.com Stable-dep-of: cb97bf3d4f91 ("i2c: qcom-geni: Fix hardcoded clock index in SE_GENI_CLK_SEL") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-qcom-geni.c | 46 +++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 22 deletions(-) --- 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 +struct geni_i2c_desc { + bool no_dma_support; + unsigned int tx_fifo_depth; +}; + #define QCOM_I2C_MIN_NUM_OF_MSGS_MULTI_DESC 2 /** @@ -120,11 +125,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; }; struct geni_i2c_err_log { @@ -941,15 +942,6 @@ static const struct i2c_algorithm geni_i .functionality = geni_i2c_func, }; -#ifdef CONFIG_ACPI -static const struct acpi_device_id geni_i2c_acpi_match[] = { - { "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) @@ -989,7 +981,6 @@ err_tx: static int geni_i2c_init(struct geni_i2c_dev *gi2c) { - const struct geni_i2c_desc *desc = NULL; u32 proto, tx_depth; bool fifo_disable; int ret; @@ -1012,8 +1003,7 @@ static int geni_i2c_init(struct geni_i2c goto err; } - desc = device_get_match_data(gi2c->se.dev); - if (desc && desc->no_dma_support) { + if (gi2c->dev_data->no_dma_support) { fifo_disable = false; gi2c->no_dma = true; } else { @@ -1033,8 +1023,8 @@ static int geni_i2c_init(struct geni_i2c tx_depth = geni_se_get_tx_fifo_depth(&gi2c->se); /* I2C Master Hub Serial Elements doesn't have the HW_PARAM_0 register */ - if (!tx_depth && desc) - tx_depth = desc->tx_fifo_depth; + if (!tx_depth && gi2c->se.core_clk) + tx_depth = gi2c->dev_data->tx_fifo_depth; if (!tx_depth) { ret = dev_err_probe(gi2c->se.dev, -EINVAL, @@ -1077,7 +1067,6 @@ static int geni_i2c_probe(struct platfor struct geni_i2c_dev *gi2c; int ret; struct device *dev = &pdev->dev; - const struct geni_i2c_desc *desc = NULL; gi2c = devm_kzalloc(dev, sizeof(*gi2c), GFP_KERNEL); if (!gi2c) @@ -1089,7 +1078,9 @@ static int geni_i2c_probe(struct platfor if (IS_ERR(gi2c->se.base)) return PTR_ERR(gi2c->se.base); - desc = device_get_match_data(&pdev->dev); + gi2c->dev_data = device_get_match_data(&pdev->dev); + if (!gi2c->dev_data) + return -EINVAL; ret = device_property_read_u32(dev, "clock-frequency", &gi2c->clk_freq_out); @@ -1245,13 +1236,24 @@ static const struct dev_pm_ops geni_i2c_ NULL) }; +static const struct geni_i2c_desc geni_i2c = {}; + static const struct geni_i2c_desc i2c_master_hub = { .no_dma_support = true, .tx_fifo_depth = 16, }; +#ifdef CONFIG_ACPI +static const struct acpi_device_id geni_i2c_acpi_match[] = { + { "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[] = { - { .compatible = "qcom,geni-i2c" }, + { .compatible = "qcom,geni-i2c", .data = &geni_i2c }, { .compatible = "qcom,geni-i2c-master-hub", .data = &i2c_master_hub }, {} };