Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1367599lqb; Thu, 30 May 2024 08:13:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX0Eh2JOb4Yc9E/mzNrFVLXoZbq/Iwy+B+NVz6L6Y9ILxYmIEm3TpETjwrl2+kN5wO8cpy2LFF/DCztgR5qQl8vLMTpJUGgSl1Q6/uSjw== X-Google-Smtp-Source: AGHT+IGg1Sg4E7Aih7jAqxSzt2pGCPqiBZoTZ03EET2gzZW8I8EKpCGkqoY6wR0vPvGjRTTJGgAG X-Received: by 2002:a05:620a:5594:b0:792:951d:c688 with SMTP id af79cd13be357-794e9dabb82mr250595185a.24.1717082018630; Thu, 30 May 2024 08:13:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717082018; cv=pass; d=google.com; s=arc-20160816; b=M1VyuNQTMuIbUuFNs26ZmchmwetTcqvv/ZBdAtydpXky7FcumJjiLyLM3Lk136NXLQ QFiRVYTh1xfZHvzX4T9wiJ4PJAfXYNtqHOUlVPudpd0nQ2SDPOElmWed2DGQjfp8fBsS kK766hovEvgHoVl+IbHC1AoR53Av+9It1LlbSDTU6JOsockxjwI8vQknKVC2t4pKqt4A JoNtf+AZvsGY1GJsZ23mK/+4nQRHU+YFIySJ7YPr9IFYs6A5WW5/e2MtLkEYgWW2x2Ow x97zhbcq7F8AIY2Hgyh6mvPgRtt1SxujmsKov46Ef/suVO3S1RIyzXP9jdM+v7ViYJgU s3bg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=daf/2dey3dTWmKyhKaroLtEJx4VBaPCVoRBtXLsx+Qo=; fh=LDKqGB8ZNl8NmJgUmuofQ9Azw0SMDgDBwSQzUt/rWWA=; b=cieqJTiZP/Q0TXWERntvcITY8s2kJpYrL89c1bfQjXP2VJqpmhi7UgWQAsMv7N6CGx cfwiJpPR0qoggjlA2r1scaWd1LG4zi7Pf3hYhusroBWpitXf87GpkfN0y+75APwW1qbY mqqLyGgLvq5RBH6im/XFRsy90ZHfVmLvIOXiV7qtxlJCUi3RF1ffaI1IJu6ErQrnm563 iLG1nZQsKHG0XBVOlczQ4yx/xsbf8EjIujKbXJLl1ECJL9rulvYcMbKUJ6eCzM5Wgctp 31Ib7yOJAbQe43B8QfvIjvq37iF/eorr+3FcLh6n8uoXxfuMMKUPEIMS75Lvt8nMlxXv Lg9g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I45hPJ27; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-195578-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195578-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-794abd0b25dsi1448772185a.353.2024.05.30.08.13.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 08:13:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195578-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I45hPJ27; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-195578-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195578-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4F81B1C242B3 for ; Thu, 30 May 2024 15:13:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B50CB3DAC15; Thu, 30 May 2024 15:11:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="I45hPJ27" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 8E76718398D; Thu, 30 May 2024 15:11:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717081888; cv=none; b=BmEL/GNZQD2p29FswTXneQy+7r3R8pvgkZUBDvd84aGQwAUOuMnPmw/RdXRd3Dwz5RnzKPCzU/YrpEgla9pidG4GbswZ8C35glJLJvk1VS7mPD5R6KO6CfLz2Sp3NMJBWoP23qv1oxQTCKut3ckVmP1/X+9bDkWWCnPDy/d6lxM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717081888; c=relaxed/simple; bh=cyTnsqcupVXst0FyS+yA1egD0GK0RbG+Gy/mnXGgt3g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EHXMaqzSf1Pi0Uip7ur0wcjze/3PB1+RKQapGpTCym5tJEUlAUrLKRE3TahnlQ1SQPcALFbmJsXDPy1Fl2zyP2LxSj7lw3bT2aq1DiOLqzRfcIXC+ji7Dlbup6TlEa5dXhFRwa2KzFXlE8BemiVpDXCbTU3dup6Upfvk6/cCGfQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=I45hPJ27; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717081886; x=1748617886; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cyTnsqcupVXst0FyS+yA1egD0GK0RbG+Gy/mnXGgt3g=; b=I45hPJ2713fkO4tvlkToMiOVMjhUGF/1lO+9VheENaK0KtgG8V/5g6Yf xnLmfBfQT0Kvci8nEWxgh22ZJNbP5iqdFA1AZ1RuyM0/QxYuAi5jb1LbQ lnU/tR/mGMHl7238SFQUS3a29ntLfc+WalN5lbnS+9swp4oPKX/dnkxie 4E8xIg7Bvd+osjXjG08giMSwc3jk6e64mpa8XL3PAHjccU04rO5Fkwiet lfKnvG4kuUNLmmdgeeG6CM5DuwDnNAjC7P21v6yfr3Y4x+h7ctLutXMjn U4WM4aZdQ3PYp1RAt9Y1IPGbT7KmeEr4uMJFvR7qkPOET75safko43nqw g==; X-CSE-ConnectionGUID: 0pZUovU6Rk+fk5N5TUQjWw== X-CSE-MsgGUID: +IQiDldbTYKztilk0KxyTQ== X-IronPort-AV: E=McAfee;i="6600,9927,11088"; a="31067960" X-IronPort-AV: E=Sophos;i="6.08,201,1712646000"; d="scan'208";a="31067960" 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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) -- 2.43.0.rc1.1336.g36b5255a03ac