From patchwork Wed Feb 15 15:54:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 57608 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp267890wrn; Wed, 15 Feb 2023 07:56:28 -0800 (PST) X-Google-Smtp-Source: AK7set9AAWCeKwE9IKZIDojWB/IUvhNfSSzXvWAGjdGcrlJPy9X8nAH7dMK78ZJOteT1+GUhTwF5 X-Received: by 2002:a05:6402:1218:b0:4ac:c642:2572 with SMTP id c24-20020a056402121800b004acc6422572mr2356495edw.31.1676476588278; Wed, 15 Feb 2023 07:56:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676476588; cv=none; d=google.com; s=arc-20160816; b=Me+LuuNN62CDGVqBpm3m/Z5gKHCQnndeOtnX+XIkg8fULhIrZyzdXHQ/kFUrs5WUBP Iue5u+26LYtj0UgIU3EZLpPnogpACiv1QstOwP6q9gOWV2ZR4d/rK0xFhoiFHsgopJwy QAaKEfahl4tL852BwsrzseBj+KK863KEQnkCDJbd+E3THYvQokE2HsxCSWlbKjSatEbp KN+w1Y+pvzs/QKVE+h3tb9RRTnPwwh+3qeIlmIMikm+M1yqjVCYZwVyyaUpndvlGc2qt FlGyHLRvZtYEmGwuHcGPa5K5msHJ+loP4UDRjJxSjsvI/CZHvW6BXsIaeUUvXEZo9pE/ 3W1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=IqWSlgpxcV5cdJ743bYOybVP4Q/LB3FMP7aXmBx5FVw=; b=GGshYLFiTFMOv1uAQlA6XfuHO+hJsgVcXyAZ7JeLrlkCB1w55f4GnldMPxGB3zW7Sb fmXde2QogLtUOfsQN9MVNHcpGHvwqT8uvAKrEjdRer3MWQyfZXj0EKrXIR4JUJ03Mj9d fA7DB0tWQB/MtkHE0NVbDsnY5zX/Gh7Gxf58hHmLoXZkC360mZy5910tlZUmEiJ1n5A8 FBqICwlsg7tNxyUDtEGKCeheLYQG4HRcFCUYHLOpCf+ZPTWByjmxSVDcSKDyiT+EcJix VLucdtGguqBR63QI8PGm4xGF+VMVijW5K9DBr6O5UzhP89m1hAH3T27zDsfOFivjohYv 8/yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iGkvYF1O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o13-20020aa7dd4d000000b004aad0c7e385si21241065edw.270.2023.02.15.07.56.04; Wed, 15 Feb 2023 07:56:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iGkvYF1O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229808AbjBOPxj (ORCPT + 99 others); Wed, 15 Feb 2023 10:53:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229574AbjBOPxi (ORCPT ); Wed, 15 Feb 2023 10:53:38 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4EE7A8; Wed, 15 Feb 2023 07:53:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676476417; x=1708012417; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=yIKGd7FoFaGRp6BU29AqU43/ancNCuEFGnNrQFiVP/E=; b=iGkvYF1OTYmcG0QccAzYfwujE2143wmtURkEuDCkN0xGdyob2VjCQ3Gi NI0NOCka/L6XbqOifkvDhuWw3ZF7rHnJIDHMVhwcDdshMEqBQ5vnImlqk scPJqlJkVfqnV7Of32tshiUZkUOgrqcdBD+4gk2SovnHxMOs84f3h/7QF keVEcF24ECORw4EaElosWzU7jCT726Bi4gnGJlrN34BLn2l0Hl3nDw4SY VGu4HDW8LxomQU5uoyRjtoA6L3o+XbSxQDpKDAvXG6TWnv3LyOcbAsyB3 slDQyD9i07oC3gnYEscbVoRImA1wuWEaOvnqcGZ9bZ+h999fVqdgo9iZB w==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="393863381" X-IronPort-AV: E=Sophos;i="5.97,300,1669104000"; d="scan'208";a="393863381" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2023 07:53:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="619490478" X-IronPort-AV: E=Sophos;i="5.97,300,1669104000"; d="scan'208";a="619490478" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 15 Feb 2023 07:53:33 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6392D1A6; Wed, 15 Feb 2023 17:54:13 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org Cc: Ludovic Desroches , Ulf Hansson , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Chas Williams <3chas3@gmail.com> Subject: [PATCH v1 1/2] mmc: atmel-mci: Get rid of external platform data Date: Wed, 15 Feb 2023 17:54:09 +0200 Message-Id: <20230215155410.80944-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757913114841633718?= X-GMAIL-MSGID: =?utf-8?q?1757913114841633718?= There is no in-kernel user that uses platform data. Hide it. This will allow the further cleanups to the driver. Signed-off-by: Andy Shevchenko --- drivers/mmc/host/atmel-mci.c | 75 ++++++++++++++++++++---------------- include/linux/atmel-mci.h | 46 ---------------------- 2 files changed, 41 insertions(+), 80 deletions(-) delete mode 100644 include/linux/atmel-mci.h diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index b51001c68786..fad5e6b4c654 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c @@ -30,7 +30,6 @@ #include #include -#include #include #include #include @@ -40,6 +39,41 @@ #include #include +#define ATMCI_MAX_NR_SLOTS 2 + +/** + * struct mci_slot_pdata - board-specific per-slot configuration + * @bus_width: Number of data lines wired up the slot + * @detect_pin: GPIO pin wired to the card detect switch + * @wp_pin: GPIO pin wired to the write protect sensor + * @detect_is_active_high: The state of the detect pin when it is active + * @non_removable: The slot is not removable, only detect once + * + * If a given slot is not present on the board, @bus_width should be + * set to 0. The other fields are ignored in this case. + * + * Any pins that aren't available should be set to a negative value. + * + * Note that support for multiple slots is experimental -- some cards + * might get upset if we don't get the clock management exactly right. + * But in most cases, it should work just fine. + */ +struct mci_slot_pdata { + unsigned int bus_width; + int detect_pin; + int wp_pin; + bool detect_is_active_high; + bool non_removable; +}; + +/** + * struct mci_platform_data - board-specific MMC/SDcard configuration + * @slot: Per-slot configuration data. + */ +struct mci_platform_data { + struct mci_slot_pdata slot[ATMCI_MAX_NR_SLOTS]; +}; + /* * Superset of MCI IP registers integrated in Atmel AT91 Processor * Registers and bitfields marked with [2] are only available in MCI2 @@ -593,7 +627,6 @@ static void atmci_init_debugfs(struct atmel_mci_slot *slot) &host->completed_events); } -#if defined(CONFIG_OF) static const struct of_device_id atmci_dt_ids[] = { { .compatible = "atmel,hsmci" }, { /* sentinel */ } @@ -651,13 +684,6 @@ atmci_of_init(struct platform_device *pdev) return pdata; } -#else /* CONFIG_OF */ -static inline struct mci_platform_data* -atmci_of_init(struct platform_device *dev) -{ - return ERR_PTR(-EINVAL); -} -#endif static inline unsigned int atmci_get_version(struct atmel_mci *host) { @@ -2353,23 +2379,6 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot, static int atmci_configure_dma(struct atmel_mci *host) { host->dma.chan = dma_request_chan(&host->pdev->dev, "rxtx"); - - if (PTR_ERR(host->dma.chan) == -ENODEV) { - struct mci_platform_data *pdata = host->pdev->dev.platform_data; - dma_cap_mask_t mask; - - if (!pdata || !pdata->dma_filter) - return -ENODEV; - - dma_cap_zero(mask); - dma_cap_set(DMA_SLAVE, mask); - - host->dma.chan = dma_request_channel(mask, pdata->dma_filter, - pdata->dma_slave); - if (!host->dma.chan) - host->dma.chan = ERR_PTR(-ENODEV); - } - if (IS_ERR(host->dma.chan)) return PTR_ERR(host->dma.chan); @@ -2457,13 +2466,11 @@ static int atmci_probe(struct platform_device *pdev) regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!regs) return -ENXIO; - pdata = pdev->dev.platform_data; - if (!pdata) { - pdata = atmci_of_init(pdev); - if (IS_ERR(pdata)) { - dev_err(&pdev->dev, "platform data not available\n"); - return PTR_ERR(pdata); - } + + pdata = atmci_of_init(pdev); + if (IS_ERR(pdata)) { + dev_err(&pdev->dev, "platform data not available\n"); + return PTR_ERR(pdata); } irq = platform_get_irq(pdev, 0); @@ -2668,7 +2675,7 @@ static struct platform_driver atmci_driver = { .driver = { .name = "atmel_mci", .probe_type = PROBE_PREFER_ASYNCHRONOUS, - .of_match_table = of_match_ptr(atmci_dt_ids), + .of_match_table = atmci_dt_ids, .pm = &atmci_dev_pm_ops, }, }; diff --git a/include/linux/atmel-mci.h b/include/linux/atmel-mci.h deleted file mode 100644 index 1491af38cc6e..000000000000 --- a/include/linux/atmel-mci.h +++ /dev/null @@ -1,46 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __LINUX_ATMEL_MCI_H -#define __LINUX_ATMEL_MCI_H - -#include -#include - -#define ATMCI_MAX_NR_SLOTS 2 - -/** - * struct mci_slot_pdata - board-specific per-slot configuration - * @bus_width: Number of data lines wired up the slot - * @detect_pin: GPIO pin wired to the card detect switch - * @wp_pin: GPIO pin wired to the write protect sensor - * @detect_is_active_high: The state of the detect pin when it is active - * @non_removable: The slot is not removable, only detect once - * - * If a given slot is not present on the board, @bus_width should be - * set to 0. The other fields are ignored in this case. - * - * Any pins that aren't available should be set to a negative value. - * - * Note that support for multiple slots is experimental -- some cards - * might get upset if we don't get the clock management exactly right. - * But in most cases, it should work just fine. - */ -struct mci_slot_pdata { - unsigned int bus_width; - int detect_pin; - int wp_pin; - bool detect_is_active_high; - bool non_removable; -}; - -/** - * struct mci_platform_data - board-specific MMC/SDcard configuration - * @dma_slave: DMA slave interface to use in data transfers. - * @slot: Per-slot configuration data. - */ -struct mci_platform_data { - void *dma_slave; - dma_filter_fn dma_filter; - struct mci_slot_pdata slot[ATMCI_MAX_NR_SLOTS]; -}; - -#endif /* __LINUX_ATMEL_MCI_H */