From patchwork Sun Dec 6 18:34:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 553171 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 45C55140297 for ; Mon, 7 Dec 2015 05:37:31 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ADBC44B7D5; Sun, 6 Dec 2015 19:36:30 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QS6oJXCNmmNt; Sun, 6 Dec 2015 19:36:30 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6A8F34B7DB; Sun, 6 Dec 2015 19:36:18 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 12E9B4B786 for ; Sun, 6 Dec 2015 19:36:14 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0InGTCcZde2F for ; Sun, 6 Dec 2015 19:36:14 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pa0-f68.google.com (mail-pa0-f68.google.com [209.85.220.68]) by theia.denx.de (Postfix) with ESMTPS id 0B6D54B7AD for ; Sun, 6 Dec 2015 19:36:02 +0100 (CET) Received: by pacfl14 with SMTP id fl14so15502822pac.1 for ; Sun, 06 Dec 2015 10:36:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BW4U7AuMQngKr79j3UKEgxmvrrlgG5bSCxsXkJ68wNM=; b=CP0S2YxQu3B7f56Eii9gkroLPurYFnKL/FGO+wp0sjwEsN4RZzf29F47VAScrOmhsR vz8YpjKgHWgddKea+qsdvzVr7TsHiie9ffV14q64LLyqVq7Il8TOwP2FZvK+7vBkQJYG uMMN3NA1pciwyA5IJY+LnQC6Nv7LiKM9tRjMZThy4SctyS2YnEX4JnDACb2S/+cWsIdw 3t2aRUXdoWBtSEySl6wjID94lCj6uT0ZnruwzgevQRj+4LNUYBtEFsSsMrC3CVQNg3Nc INe/0569/YZbmcLPwJHfOuecOAyEtL6PGclDBnkXZqjBlesy4o+9sUUNRiPF/pG0nXm2 e9xg== X-Received: by 10.66.199.5 with SMTP id jg5mr37583867pac.72.1449426961655; Sun, 06 Dec 2015 10:36:01 -0800 (PST) Received: from localhost.localdomain ([123.236.183.133]) by smtp.gmail.com with ESMTPSA id 87sm29494345pfj.23.2015.12.06.10.35.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 06 Dec 2015 10:36:00 -0800 (PST) From: Jagan Teki To: u-boot@lists.denx.de Date: Mon, 7 Dec 2015 00:04:24 +0530 Message-Id: <1449426866-696-13-git-send-email-jteki@openedev.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449426866-696-1-git-send-email-jteki@openedev.com> References: <1449426866-696-1-git-send-email-jteki@openedev.com> Cc: Tom Rini , Michal Simek , Jagan Teki , Stefan Roese Subject: [U-Boot] [PATCH v8 12/14] sf: sf_probe: Remove spi_slave pointer argument X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since spi_slave is a spi pointer in spi_flash{} then assign spi_slave{} pointer to flash->spi and remove spi_slave pointer argument to - spi_flash_probe_slave - spi_flash_scan Cc: Simon Glass Signed-off-by: Jagan Teki Reviewed-by: Simon Glass Reviewed-by: Bin Meng Tested-by: Bin Meng --- drivers/mtd/spi/sf_internal.h | 3 +-- drivers/mtd/spi/sf_ops.c | 4 ++-- drivers/mtd/spi/sf_probe.c | 12 +++++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h index 16dd45b..ed5c391 100644 --- a/drivers/mtd/spi/sf_internal.h +++ b/drivers/mtd/spi/sf_internal.h @@ -227,7 +227,6 @@ void spi_flash_mtd_unregister(void); /** * spi_flash_scan - scan the SPI FLASH - * @spi: the spi slave structure * @flash: the spi flash structure * * The drivers can use this fuction to scan the SPI FLASH. @@ -236,6 +235,6 @@ void spi_flash_mtd_unregister(void); * * Return: 0 for success, others for failure. */ -int spi_flash_scan(struct spi_slave *spi, struct spi_flash *flash); +int spi_flash_scan(struct spi_flash *flash); #endif /* _SF_INTERNAL_H_ */ diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c index 68f191b..c065858 100644 --- a/drivers/mtd/spi/sf_ops.c +++ b/drivers/mtd/spi/sf_ops.c @@ -896,8 +896,9 @@ int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash) } #endif /* CONFIG_IS_ENABLED(OF_CONTROL) */ -int spi_flash_scan(struct spi_slave *spi, struct spi_flash *flash) +int spi_flash_scan(struct spi_flash *flash) { + struct spi_slave *spi = flash->spi; const struct spi_flash_params *params; u16 jedec, ext_jedec; u8 idcode[5]; @@ -946,7 +947,6 @@ int spi_flash_scan(struct spi_slave *spi, struct spi_flash *flash) write_sr(flash, 0); /* Assign spi data */ - flash->spi = spi; flash->name = params->name; flash->memory_map = spi->memory_map; flash->dual_flash = flash->spi->option; diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index f8aad56..bf53eef 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -20,12 +20,12 @@ /** * spi_flash_probe_slave() - Probe for a SPI flash device on a bus * - * @spi: Bus to probe * @flashp: Pointer to place to put flash info, which may be NULL if the * space should be allocated */ -int spi_flash_probe_slave(struct spi_slave *spi, struct spi_flash *flash) +int spi_flash_probe_slave(struct spi_flash *flash) { + struct spi_slave *spi = flash->spi; int ret; /* Setup spi_slave */ @@ -41,7 +41,7 @@ int spi_flash_probe_slave(struct spi_slave *spi, struct spi_flash *flash) return ret; } - ret = spi_flash_scan(spi, flash); + ret = spi_flash_scan(flash); if (ret) { ret = -EINVAL; goto err_read_id; @@ -68,7 +68,8 @@ struct spi_flash *spi_flash_probe_tail(struct spi_slave *bus) return NULL; } - if (spi_flash_probe_slave(bus, flash)) { + flash->spi = bus; + if (spi_flash_probe_slave(flash)) { spi_free_slave(bus); free(flash); return NULL; @@ -152,8 +153,9 @@ int spi_flash_std_probe(struct udevice *dev) flash = dev_get_uclass_priv(dev); flash->dev = dev; + flash->spi = slave; debug("%s: slave=%p, cs=%d\n", __func__, slave, plat->cs); - return spi_flash_probe_slave(slave, flash); + return spi_flash_probe_slave(flash); } static const struct dm_spi_flash_ops spi_flash_std_ops = {