From mboxrd@z Thu Jan 1 00:00:00 1970 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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 967ACC433EF for ; Tue, 19 Jul 2022 20:23:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C033484091; Tue, 19 Jul 2022 22:22:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="AJCTHohj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A6C1983FE5; Tue, 19 Jul 2022 22:22:32 +0200 (CEST) Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 510A78407C for ; Tue, 19 Jul 2022 22:22:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michael@amarulasolutions.com Received: by mail-ed1-x531.google.com with SMTP id g1so21137833edb.12 for ; Tue, 19 Jul 2022 13:22:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ak1CaqCFfHQrkM4Fc49pjN9TcfWtOX9jH41WRU1fU/I=; b=AJCTHohjlQp8ozSGTOibb3ncqEXAK1gMuZP4Cdaa3EyNiR6XzRxEclBqzlzfSW7TYD +uvXLfgNICa/w4Fy5vYZys9sWdosYsLaC3E7t9flumattYtEfowtF1Fza5L5pTlYuzxj mqLgUACSg4im3DOSA32yXtacwfm1i4WjPxqEg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ak1CaqCFfHQrkM4Fc49pjN9TcfWtOX9jH41WRU1fU/I=; b=i1TlXNRvpsCekbAem6UtM3yhw7luVTFL2nEYl8RPdwfnrObLhGYvdwkFllfsLolxkD ex7vuS2Tgodr5FJVCU1vvHmCRZS2gTia6tkRhVXtm6omVzZ0Ivk150eHSOJR4MXD3Lvt rfvPFPVbwKZkznupxdFo4gIw/0ay0FlcgP6KM8ARrKKJpm6H8vgdtuZmomksLYPgtgaj AJ+xKymQMbhrEUrfGHpBS3olt9huh8s6NsSG17LKjEpx2Y9KvViHcd5GtKHvdc+SSjHA 3Y6hA650M+q5BDk4AgmK3wSQ33gpJOLNgdDckLZpJ1R3fBIAp85JN5eL7W2EaDwfcrcM ADxA== X-Gm-Message-State: AJIora/gba9TSzq4IHo/G3QFO+PGOTDcQVJf84OjGK9gXUXeIy10Azwe vXzE8+nKkteMPyTXwS6AnHwdnbqvRkRMEeZv X-Google-Smtp-Source: AGRyM1sFVMeTjeipkXlX/OzxqM+4gaYqBiMZfBKPFFiJi4LLWRLyKgKFv2zqVmT5PdGEAKxjvg7oGQ== X-Received: by 2002:a05:6402:350c:b0:43a:e25f:d73 with SMTP id b12-20020a056402350c00b0043ae25f0d73mr46835318edd.66.1658262148214; Tue, 19 Jul 2022 13:22:28 -0700 (PDT) Received: from panicking.amarulasolutions.com (mob-37-180-67-237.net.vodafone.it. [37.180.67.237]) by smtp.gmail.com with ESMTPSA id sa8-20020a170906eda800b00726dbb16b8dsm7003243ejb.65.2022.07.19.13.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 13:22:27 -0700 (PDT) From: Michael Trimarchi To: u-boot@lists.denx.de Cc: Dario Binacchi , Tommaso Merciai , Patrice Chotard , Wolfgang Denk , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Kory Maincent , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Simon Glass Subject: [PATCH V2 04/13] mtd: nand: Get rid of mtd variable in function calls Date: Tue, 19 Jul 2022 22:21:54 +0200 Message-Id: <20220719202213.1753259-5-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220719202213.1753259-1-michael@amarulasolutions.com> References: <20220719202213.1753259-1-michael@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean chip points to mtd. Passing chip is enough to have a reference to mtd when is necessary Signed-off-by: Michael Trimarchi --- V1->V2: - no changes --- drivers/mtd/nand/raw/nand_base.c | 20 +++++++++++--------- include/linux/mtd/rawnand.h | 3 +-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 3b9c78cb24..7d52372af5 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -4160,8 +4160,9 @@ static int nand_get_bits_per_cell(u8 cellinfo) * chip. The rest of the parameters must be decoded according to generic or * manufacturer-specific "extended ID" decoding patterns. */ -static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip) +static void nand_decode_ext_id(struct nand_chip *chip) { + struct mtd_info *mtd = &chip->mtd; int extid, id_len; /* The 3rd id byte holds MLC / multichip data */ chip->bits_per_cell = nand_get_bits_per_cell(chip->id.data[2]); @@ -4291,7 +4292,7 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip) * compliant and does not have a full-id or legacy-id entry in the nand_ids * table. */ -static void nand_manufacturer_detect(struct mtd_info *mtd, struct nand_chip *chip) +static void nand_manufacturer_detect(struct nand_chip *chip) { /* * Try manufacturer detection if available and use @@ -4301,7 +4302,7 @@ static void nand_manufacturer_detect(struct mtd_info *mtd, struct nand_chip *chi chip->manufacturer.desc->ops->detect) chip->manufacturer.desc->ops->detect(chip); else - nand_decode_ext_id(mtd, chip); + nand_decode_ext_id(chip); } /* @@ -4324,9 +4325,10 @@ static int nand_manufacturer_init(struct nand_chip *chip) * decodes a matching ID table entry and assigns the MTD size parameters for * the chip. */ -static void nand_decode_id(struct mtd_info *mtd, struct nand_chip *chip, +static void nand_decode_id(struct nand_chip *chip, struct nand_flash_dev *type) { + struct mtd_info *mtd = &chip->mtd; int maf_id = chip->id.data[0]; mtd->erasesize = type->erasesize; @@ -4439,11 +4441,11 @@ static const struct nand_manufacturers *nand_get_manufacturer_desc(u8 id) /* * Get the flash and manufacturer id and lookup if the type is supported. */ -struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, - struct nand_chip *chip, +struct nand_flash_dev *nand_get_flash_type(struct nand_chip *chip, int *maf_id, int *dev_id, struct nand_flash_dev *type) { + struct mtd_info *mtd = &chip->mtd; const struct nand_manufacturers *manufacturer_desc; int busw, ret; u8 *id_data = chip->id.data; @@ -4539,9 +4541,9 @@ struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, chip->chipsize = (uint64_t)type->chipsize << 20; if (!type->pagesize) { - nand_manufacturer_detect(mtd, chip); + nand_manufacturer_detect(chip); } else { - nand_decode_id(mtd, chip, type); + nand_decode_id(chip, type); } /* Get chip options */ @@ -4731,7 +4733,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips, nand_set_defaults(chip, chip->options & NAND_BUSWIDTH_16); /* Read the flash type */ - type = nand_get_flash_type(mtd, chip, &nand_maf_id, + type = nand_get_flash_type(chip, &nand_maf_id, &nand_dev_id, table); if (IS_ERR(type)) { diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h index 57fe7fb47b..d8141cb4d1 100644 --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h @@ -29,8 +29,7 @@ struct nand_flash_dev; struct device_node; /* Get the flash and manufacturer id and lookup if the type is supported. */ -struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, - struct nand_chip *chip, +struct nand_flash_dev *nand_get_flash_type(struct nand_chip *chip, int *maf_id, int *dev_id, struct nand_flash_dev *type); -- 2.34.1