From patchwork Thu Jul 14 14:35:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 2170 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 4561F3F066 for ; Thu, 14 Jul 2022 16:36:01 +0200 (CEST) Received: by mail-wm1-f69.google.com with SMTP id 130-20020a1c0288000000b003a2fe999093sf1851603wmc.6 for ; Thu, 14 Jul 2022 07:36:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657809361; cv=pass; d=google.com; s=arc-20160816; b=DJGrAFYhqLaZlJ4ZoEteaRBETpmetnJgEq4VgTUWrT5dz14xPAvr5Gi5ba+7UM+Mmy N7Pf+rbwpYmRogF/YAAknkfjBdcUk8wbPqI8/zGVaipVHTZYJTPNsC9Ls3iAET527Koh S5hxtF5swaLZwWunuy7KtMkMoyefzZlP5EeaH+RuTmUafB6R05q+q69Lv78gECxS2jiJ x2YrljZXv3PZKZewPhplDoHIUHY4sat/Clb/fJj10XUH/XsTG0VS80WF6rzCotqwxkFq FDqzw/5aOzTmYV968E3BVt3M0lXUqXvC62s5PQl3kNg/ecdDOkdNz7F8aCkUdim6MOka Ut6w== 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=bWsYoxh4EGG5Y6a44K3Swhi9kgqogfWRi+rHQcZlZ34=; b=E1m8PDbvISRWogv9CGzZLEVxHqFLX2k3br+yf+R1tl6lwI0wK12SKYEoyjJYcFUAAB Y5gvpePWL6t6s8C/XM684a+GZyYxyw7bMri6TPZdJhTArLIcsONpKbPav6nG7xBs2khG sLt1p/5kC0YyJ8oSwmFC7fHsj9X1QdRPJILBrFA2IObpm2pp5UHcSuzM03XqHI85Ohpk pNuQBwY7/wsqOBKe9+dkyEwVf2oqwBvyHec1JqdDsOmC8WcTb7+EappVeZH+pi2I/JaV GGrbzBSOFbVp2krbbX8yHEnX40BxhiE43Nf5OUq0yWDKapyJTMteq7wx379U3yt3/rj1 mdRA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="hn/bpe60"; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=bWsYoxh4EGG5Y6a44K3Swhi9kgqogfWRi+rHQcZlZ34=; b=rclIxRhQQ3PMCmtLSzTRRO1J+DGYwTMI6gwiI4VMYxngG0f5b+iv7BUD8BOQUWfnT8 Z276aEQh92AY+/ejiSDj3vhEOnlajZmCcFJD4YxsLr9LI1w+O9cWmVon/rGMfL29cKRs 2ae3DbrAW1IK7MJVTP9yD1DGG72dDrDoVUmdY= 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=bWsYoxh4EGG5Y6a44K3Swhi9kgqogfWRi+rHQcZlZ34=; b=WrnYY0FH+/jxeRt/Q2VVx2mkGK3oaRJq0uKehuiYccDLoMaHh8/Fshlb0dJDxA1TnA VToo/6sDlnkz5U9TneimndqaRYsTZfP8C0wMUU388Hovo/ak8/WDixiKjGQeGUTOoUlr uxiG6J29C5M+RBy0x3mA72HWu4gqM2/46okcgNpOvER/VqmU1PvGUOPplrL1g5kUPxXA hKfRzPoni4Jl/dZXfHJLK9ySb/QmG6zeQ+6pL8T8uXYZKLbsE0txhBd82QZZzlyEB5iB BeBqiNTAU3vLtJFreMavxm2KHyXPTVqC/n44SLg4/Q/Mg57YGFfngn43Op80SYZhcWbU vAIA== X-Gm-Message-State: AJIora9sVnPnrw4la+CNzMYWUJw/7SANper3cqHYm5Iy753G4kl7pqvI uShm0lyxvredUoGS8iLmLL6EuGLh X-Google-Smtp-Source: AGRyM1v24evZ/uezD+MVIe56+SBI1TX1TbClYUOBe9gfwrRY0J30E33BX4iBZKjEGQ1RhBCs7xgTng== X-Received: by 2002:a05:600c:3b17:b0:3a2:ee46:e312 with SMTP id m23-20020a05600c3b1700b003a2ee46e312mr15153537wms.49.1657809361073; Thu, 14 Jul 2022 07:36:01 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a5d:588d:0:b0:21d:339f:dc1 with SMTP id n13-20020a5d588d000000b0021d339f0dc1ls242428wrf.0.gmail; Thu, 14 Jul 2022 07:36:00 -0700 (PDT) X-Received: by 2002:a5d:4c49:0:b0:21d:6df5:beb7 with SMTP id n9-20020a5d4c49000000b0021d6df5beb7mr8609960wrt.286.1657809359787; Thu, 14 Jul 2022 07:35:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657809359; cv=none; d=google.com; s=arc-20160816; b=CGuPDb2Fu8XLQLbqTeD+SU2Ycta7+/d3Qx6ScWEtD5U4AQEarKjd/Vf6a1CAYB4XY3 NDwcXEweeBsgHBZrk3fjyljnRY7jEZ37jzyjQp5raWPv9QyrquqpVniL/jx8kZqLcXbi BiLRMGNL/4YsT1KDTjsXhna9AepFVxGmgyxPQxRSyquqHdQYtM0xPYWnwwNSMkRFZ5vj v1WHJvKjTigI4VuZ+7e3lJi3zrPRgMIlNrWKUwbyWwjsWhNBFZlhDAhrUEnbX2j0n/BD M/pXDdUQzMgrkBpl+f+vR1FtDuJnUEgMvAtr6aEAdEi6swzmRbk/ttyQt6luS69Lkr2z gNCA== 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=8r1tMsApi1aj9SR1CafRswHj8lBfItFykhvwhV0futo=; b=ifq5/yZH1wc2tKgDhbo+uokwApMTVLIDvyD4WDtRyGtAGghRkG6Jw4rQoIKmo4vqi8 G/rJAuREraWKenWbqTkwwNPwuX3iO25c9rH/LW1y9fntJAqNHzKkl+6ZrymRKZTUVL87 Fh4Iym0WgTerCyDVH56jvqkGGFSVhGsHbvLM9U1aUfRAk2ETfw4V3o5owH9y3vRxzgLm TjjWJuo76fgonrIbtUSIB4quxUQ10+w5UPGQ8SBpZarm+vF/fU+Ebt33bnuqZ2efcrDn uU5j8MtrIehICshxGC/vC1ZxpP3cyrU4ppZ5NP/h0MnVQKxxGdPQG1offjw2jeGLx9Zi fjrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="hn/bpe60"; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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 az12-20020a05600c600c00b003a2f1edf4f0sor2630272wmb.0.2022.07.14.07.35.59 for (Google Transport Security); Thu, 14 Jul 2022 07:35:59 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:4e8f:b0:3a1:8b21:ebbc with SMTP id f15-20020a05600c4e8f00b003a18b21ebbcmr9635135wmq.149.1657809359053; Thu, 14 Jul 2022 07:35:59 -0700 (PDT) Received: from panicking.. ([2.198.242.86]) by smtp.gmail.com with ESMTPSA id u18-20020a05600c19d200b003973c54bd69sm5712357wmq.1.2022.07.14.07.35.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 07:35:58 -0700 (PDT) From: Michael Trimarchi To: linux-amarula@amarulasolutions.com, Dario Binacchi , Tommaso Merciai , Boris Brezillon , Richard Weinberger , Patrice Chotard , Marek Vasut , Wolfgang Denk , u-boot@lists.denx.de (open list) Cc: u-boot@lists.denx.de (open list) Subject: [PATCH 04/11] mtd: nand: Get rid of mtd variable in function calls Date: Thu, 14 Jul 2022 16:35:36 +0200 Message-Id: <20220714143543.448991-5-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220714143543.448991-1-michael@amarulasolutions.com> References: <20220714143543.448991-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="hn/bpe60"; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , chip points to mtd. Passing chip is enough to have a reference to mtd when is necessary Signed-off-by: Michael Trimarchi --- 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);