From patchwork Thu May 30 15:10:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13680537 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 09A33C27C4F for ; Thu, 30 May 2024 15:12:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kN4SRcUzRLVZ401V2rZEI/DZUcDpNtcSVl/BG/L3q6c=; b=cVcpj0TqO9AQWU 29JvNSiKsUFkQlLf5jkmAHhUBP+EOxp7Q+Ss7JD/elg7jQuqWXy2Ov+gXnIm3wrQrQ92+/FCqdTg0 6q4axDtACeglHkhQr9Nc5zzjdQCOQjz//WVUmS4rF4D6zFEAH/1TfeOsiaCxwb3nCcVY3vqTbDxZ0 jSRlZEDbrnf8syu7NVU+uc6Ee295MFcU7J4EOTx4DtwDgnqhdmhA3sCgnniQsrTgKc9QcYDoY+kvf LHsn5p2HXZ57/xTte2mNVAxjBVlO4HsPlT71jAulYNTNayHn8zW00PYFoIaTt7sjyqpp3Mvr8X0xd ALKs0kdp/sbOL2T801gw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sChRf-00000007f8L-2jiN; Thu, 30 May 2024 15:11:59 +0000 Received: from mgamail.intel.com ([198.175.65.10]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sChRB-00000007epg-1nqN for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2024 15:11:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717081889; x=1748617889; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cyTnsqcupVXst0FyS+yA1egD0GK0RbG+Gy/mnXGgt3g=; b=MZWqtXt9xpQkDDGLhEMixt7SuRtG9JLkmOo/7BrBeSN3vI1NMxsPMTmZ RHF+dX1Ip0C7REyXcwnD4RbZydq6jEZVNGAxpRFw+E8MdMxNGVpqwYbG7 vSkVfK70k+ZxUvVNS74WbeNzIO6YPf0nc85zIBN4RVGuflwDku+x49au1 7NpRvw5QyW+OBEl8+QAXHWATrTp1eFeT2pQXlGe+nsfmmnAUpKlTXIHuk KfGJD6sku6D+g8OQauhhv1bW6xxSJk9mqJCqp17gSmSBA4+SLRJV/CELm qqCRqhx632PC+lNMDKlM1ReLPfnZTyadUV+2Ugs4yBGFBK+qN53CtR6F2 w==; X-CSE-ConnectionGUID: TwNgiue1Ssq1+hBkAQT72w== X-CSE-MsgGUID: 01Tko0JnQ+OPtlJzjbvWrQ== X-IronPort-AV: E=McAfee;i="6600,9927,11088"; a="31067956" X-IronPort-AV: E=Sophos;i="6.08,201,1712646000"; d="scan'208";a="31067956" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2024 08:11:25 -0700 X-CSE-ConnectionGUID: TJQT913DSqmlAiaG5MJS2Q== X-CSE-MsgGUID: OvvpV2LGRful5O8h0mDMvg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,201,1712646000"; d="scan'208";a="73329441" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa001.jf.intel.com with ESMTP; 30 May 2024 08:11:24 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 793CA6F1; Thu, 30 May 2024 18:11:19 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Andy Shevchenko , Linus Walleij , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik Subject: [PATCH v2 09/11] spi: pxa2xx: Extract pxa2xx_spi_platform_*() callbacks Date: Thu, 30 May 2024 18:10:05 +0300 Message-ID: <20240530151117.1130792-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240530151117.1130792-1-andriy.shevchenko@linux.intel.com> References: <20240530151117.1130792-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240530_081129_746795_3BB8C9E5 X-CRM114-Status: GOOD ( 17.36 ) 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 In preparation of the extracting platform driver from spi-pxa2xx.c split the probe and remove functions so we have bus independent and platform device ones. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-pxa2xx.c | 52 +++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 3c03a8cd9ee6..74f242e652df 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1413,30 +1413,16 @@ static size_t pxa2xx_spi_max_dma_transfer_size(struct spi_device *spi) return MAX_DMA_LEN; } -static int pxa2xx_spi_probe(struct platform_device *pdev) +static int pxa2xx_spi_probe(struct device *dev, struct ssp_device *ssp) { - struct device *dev = &pdev->dev; struct pxa2xx_spi_controller *platform_info; struct spi_controller *controller; struct driver_data *drv_data; - struct ssp_device *ssp; const struct lpss_config *config; int status; u32 tmp; platform_info = dev_get_platdata(dev); - if (!platform_info) { - platform_info = pxa2xx_spi_init_pdata(pdev); - if (IS_ERR(platform_info)) - return dev_err_probe(dev, PTR_ERR(platform_info), "missing platform data\n"); - } - - ssp = pxa2xx_spi_ssp_request(pdev); - if (IS_ERR(ssp)) - return PTR_ERR(ssp); - if (!ssp) - ssp = &platform_info->ssp; - if (platform_info->is_target) controller = devm_spi_alloc_target(dev, sizeof(*drv_data)); else @@ -1628,9 +1614,8 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) return status; } -static void pxa2xx_spi_remove(struct platform_device *pdev) +static void pxa2xx_spi_remove(struct device *dev) { - struct device *dev = &pdev->dev; struct driver_data *drv_data = dev_get_drvdata(dev); struct ssp_device *ssp = drv_data->ssp; @@ -1708,6 +1693,35 @@ static const struct dev_pm_ops pxa2xx_spi_pm_ops = { RUNTIME_PM_OPS(pxa2xx_spi_runtime_suspend, pxa2xx_spi_runtime_resume, NULL) }; +static int pxa2xx_spi_platform_probe(struct platform_device *pdev) +{ + struct pxa2xx_spi_controller *platform_info; + struct device *dev = &pdev->dev; + struct ssp_device *ssp; + + platform_info = dev_get_platdata(dev); + if (!platform_info) { + platform_info = pxa2xx_spi_init_pdata(pdev); + if (IS_ERR(platform_info)) + return dev_err_probe(dev, PTR_ERR(platform_info), "missing platform data\n"); + + dev->platform_data = platform_info; + } + + ssp = pxa2xx_spi_ssp_request(pdev); + if (IS_ERR(ssp)) + return PTR_ERR(ssp); + if (!ssp) + ssp = &platform_info->ssp; + + return pxa2xx_spi_probe(dev, ssp); +} + +static void pxa2xx_spi_platform_remove(struct platform_device *pdev) +{ + pxa2xx_spi_remove(&pdev->dev); +} + static const struct acpi_device_id pxa2xx_spi_acpi_match[] = { { "80860F0E" }, { "8086228E" }, @@ -1732,8 +1746,8 @@ static struct platform_driver driver = { .acpi_match_table = pxa2xx_spi_acpi_match, .of_match_table = pxa2xx_spi_of_match, }, - .probe = pxa2xx_spi_probe, - .remove_new = pxa2xx_spi_remove, + .probe = pxa2xx_spi_platform_probe, + .remove_new = pxa2xx_spi_platform_remove, }; static int __init pxa2xx_spi_init(void)