From patchwork Fri Jul 22 16:09:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2233 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 636EA3F047 for ; Fri, 22 Jul 2022 18:11:13 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id g7-20020a056402424700b0043ac55ccf15sf3117593edb.4 for ; Fri, 22 Jul 2022 09:11:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658506273; cv=pass; d=google.com; s=arc-20160816; b=0mzrRDyxP5E7MfCl1wn3sfSnVBb/Iws03a8Aj/fcjtsjZEpS1h/B9Q63pDX0nReodR xp+VP++4NmPVA4YDnLNkQ5HkRqh01RVf3PNmTZLAaEPAE1SXrsehaT53zz9P9CS2iLZ1 h8uxP64kKZBgT3HRZWVm9dYhXDc/mEdxp2oLX1Irl+R7MPjCOZg9bmo/BAH+wTOu7s66 tya4eOGTLvQ8xLu3Q3Piald9ELJmRWxXIzTCFuCUlRf0FDZTvSq+195rZ43y/UPwCX7W L1oWkfqXttvW/8MMpDhult+Gqmna6zxgdzSeuSPmIxLP49OyFZbnK54NgTPzcWv2ZFyD sVOQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=qqn5TwzDTjpb7SSrGiArlPPhjdSCq1sbLToKhMgACKs=; b=LGXA+ES12P4b2G+mcIBxZRUpy2u+ERsUlwKR/frueCKaOvAjBmbUFfs/SVNapcbV9g nQvx5RDKazaRt/cEJ8osR9uq+c0uF9G9M3K9k6MVN+WdxkFyM3G4R7+DApebRY0GdLp7 UjWp1f8RzQXI5xb/RdBLguPEcY5lNsqULHqAU5X9npHDsZ1jH9bQA3Q2pAZZvitgM6mO 24ByTYtWxbjnlV6zSpkY1KAm0b1wRO8haaqrGf+QYSbhJCltkMMqVTz08TOn5EI1eOGj 1+2IuKSM991sllmhBsuJ4I18woXdIG62QqRNi6hEvvopm4V7DUBIcNjfOtG05m3Fo6LV wM+Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=NjuBctze; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=qqn5TwzDTjpb7SSrGiArlPPhjdSCq1sbLToKhMgACKs=; b=PD4lXujOXs2utR499bBk0xlM4v+WraUmIbBBqmKEffkQy2D47cRLNr1JY+Lg2NXk1q bZ7AN5gJv2AtnMjROinuC3SklHPiusTj8shlEBeidcbVW5UghmcTFQZPHF5DJ3EFq7Mq MditD5OZmTnOcmkeCYubL5qvM3qSYGhwp1x7s= 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=qqn5TwzDTjpb7SSrGiArlPPhjdSCq1sbLToKhMgACKs=; b=T/ZCG1nc7JhqGFWiNAJhdkIaVeCCnyU1gHhb5U4QOoXcX/eTpOf0x5+6ppZjK9vKQy 4vBMgiv/vSPQhPcU/eRBDmwx3d76yXuyKjO2U4VN8ksAH2jI5m8FwbAn8tJmNA1GScZY dScGWiNoIinhrUJr0ZSznTy/Db59/DIEVtQ1x0up+huLR85Hb7F6zDEznV0HaWY3K8dF WRi5UzsTUk5PvMFCYsAoe+SxNQc4H7bcIzLv/d9M58zThc6dC15PCe9uvEmfCPosHJRY 8jw7fQOiY65MgmXUw+UPrFxAM2fDdBe4/fVWWfNWr9dLfRXcKqrBFz74MqB3nhl5ZTv0 Gqhg== X-Gm-Message-State: AJIora/VvDifCiHP1h7Kge2w9R8oSqxtSyZGw9W1LGuUZG7ORpONPiA7 hYLfxvPwqd3gPbSYKOZIwyFS4KS1 X-Google-Smtp-Source: AGRyM1uSY8BFqPt8HZDchBHqXlgplWsDyxPPuXKNDiZjVd9/yKa56Yl57tTqzI/MGXLA9+FFZVKIvA== X-Received: by 2002:a17:907:3da0:b0:72b:47df:c1d7 with SMTP id he32-20020a1709073da000b0072b47dfc1d7mr495005ejc.214.1658506273221; Fri, 22 Jul 2022 09:11:13 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a50:d0c9:0:b0:43a:6e16:5059 with SMTP id g9-20020a50d0c9000000b0043a6e165059ls2107193edf.2.-pod-prod-gmail; Fri, 22 Jul 2022 09:11:12 -0700 (PDT) X-Received: by 2002:a05:6402:5192:b0:43b:d728:d2aa with SMTP id q18-20020a056402519200b0043bd728d2aamr582211edd.185.1658506272000; Fri, 22 Jul 2022 09:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658506271; cv=none; d=google.com; s=arc-20160816; b=WOzXWd18eoj3qzsbnZn5S4QjOU1wg4IgQ4uCDPiHuvFk7wpGfS/TWDWim6pC431KSF OEne4UUIzxqB2DnyUpBgKK49xIFm1zSnwwBxdaU3a9Mw3P+TeJZyHaB5QHtGFo83YwMo zYgK6v2oHWAQ5x1ukxM4Kqcb+CevZ6Rz4InJpzXrxS5OTRFhypky9c8G32xCqbFIE/lB tW26tWKx6/x1Vl3M1wRfyatgYfz5h4ohm118piGZPMPPrGGNk22fDowJBB2g2efV6Jty kioB7t+IlGLkdw0fdfJYOvn7Glpvwwh83Eif3s+gYAiHDAPMWDHqoYxlGp6dD4ZnPtHY 2R1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=g1evLi2ic43/8RVgZGntz7H3u7Oa+xL7kn1fzGahP18=; b=yFwGquAWe1bfqLHwuC9w6oDwy5toQ5PpIF1Dse4Y02KDkg9c6AwS25hA83zICfPiLc 8VIX7qHOh/NJUQN0dztLG7nPE6EGaZPAjzyZieQ20hKkzdirXhMHqOit5oA6HHj8Q8LL 4JtuVDvIdWZYmZZ7tbXcn9vDk4X9avkwm0Rll1nh66OKhYZ/7OSL2ZoEKfaajIM1YjZk 9958t4Ir3UMoHKp8/iy9qPiWAg7Kq105vnG/nAGHzujV+ybAbQUKNu7y7+uEyrK0qpqL dGtM6yJiFikmNsaldanz/J846RIwZAFJR/D5+vcz/6n3qyti/ejlGiwMLGSWD0jJfGof TpBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=NjuBctze; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id kv23-20020a17090778d700b00722e1ac3ee8sor2115699ejc.110.2022.07.22.09.11.11 for (Google Transport Security); Fri, 22 Jul 2022 09:11:11 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:907:60c7:b0:72b:5651:e1f8 with SMTP id hv7-20020a17090760c700b0072b5651e1f8mr464639ejc.375.1658506271719; Fri, 22 Jul 2022 09:11:11 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.pdxnet.pdxeng.ch (host-87-14-98-67.retail.telecomitalia.it. [87.14.98.67]) by smtp.gmail.com with ESMTPSA id d19-20020a170906305300b006fe8ac6bc69sm2174025ejd.140.2022.07.22.09.11.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 09:11:11 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Amarula patchwork , michael@amarulasolutions.com, Dario Binacchi , Patrice Chotard , Simon Glass , Wolfgang Denk Subject: [PATCH v4 04/14] mtd: nand: Get rid of mtd variable in function calls Date: Fri, 22 Jul 2022 18:09:58 +0200 Message-Id: <20220722161009.2686504-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220722161009.2686504-1-dario.binacchi@amarulasolutions.com> References: <20220722161009.2686504-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=NjuBctze; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi chip points to mtd. Passing chip is enough to have a reference to mtd when is necessary Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- (no changes since v3) Changes in v3: - Fix code style warnings raised by patman. drivers/mtd/nand/raw/nand_base.c | 25 +++++++++++++------------ include/linux/mtd/rawnand.h | 3 +-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 0900e6dbf9a6..145de22be852 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,9 @@ 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, - struct nand_flash_dev *type) +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 +4440,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, - int *maf_id, int *dev_id, - struct nand_flash_dev *type) +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 +4540,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 */ @@ -4729,7 +4730,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 57fe7fb47bd8..d8141cb4d114 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);