From patchwork Wed Jul 13 07:16:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 2127 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 6845A3F066 for ; Wed, 13 Jul 2022 09:16:57 +0200 (CEST) Received: by mail-ej1-f70.google.com with SMTP id nc23-20020a1709071c1700b0072b94109144sf517528ejc.2 for ; Wed, 13 Jul 2022 00:16:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657696617; cv=pass; d=google.com; s=arc-20160816; b=dNoxUa4pQOSDdZsKMlSG+8eZrzX7L29ottCseS6NEagUbDal484LsNvE3yZQEArwTi EIQW3MbG9bk6G5Ogz5Ajbt76GVlChrhFvwARiDwkXM1LSNCN2PhYRWLdCarqjWWDLRpN avXM5mIq52wrYJh6XkuGaXfERLyI/Xc73iNfGv5mej0mfPDS1CFxM1pBkZz/ODNOsDFP 1Ytz0WtM5lvwVAvkNPKmCsUrFTNQpMKIkpr3BvXvoTbS1qA35Nk0OEtXntIHTWYNarpj cesusH4OQvSsoHASvMMJ0CnOXSZoNy5ChSsGk19szNrGgvc7OcCN6RrzJBgGeUObMqGl IHKA== 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:to:from:dkim-signature; bh=IDg9TVVrpq+dfJeFyjw/2BnAHX3YoQO88cP55qPELH4=; b=Ky+0npze7Gv8zSoUOU9T/a8VHWV5WjclHrpkARaCMU8EMia3E3gewI3gQ5C7YjY7oY kXqGI25JWFKEHPHo4Ded0VPCd9nQteuwHHQ9qKgRgeR7QldK0I2nVqR03doaI+4fH8cT Y4N4pM7Ykxx0NHDGXxMd6+5VUvaDWSO6WXTdilTnzHVKNHd6euo/+1UpP/nZyXlXXw5N Oup02nGaX1oh+t6FhKccTsjEp/jX9oku5vXLQawku0s9kmw3/x8bT9YLL2vhUDu3bgcG yUFLAjbulfBhdcZKS0C27Zs2qQUJse5ZHNStZhr1GSvZzuzTghZkBIc3iB54KThOQyJP oXhw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=fizIRujx; 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: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=IDg9TVVrpq+dfJeFyjw/2BnAHX3YoQO88cP55qPELH4=; b=HFaQiMXdv3Gl4ugvhyd7ni4yBNBqYFmi82ZzCuf3BjVsKMj9/Bx5fVeVUsEtybg7Jz aTU+XGdWmbD/491+VRIQIdiuQMC1F/TYzAwGItzzHuKr2TMt34rZ3Qw8VRUhLTyv0XVJ F6kMzJNVYl3zXv2poI2n9iY1HPo03j5zPNP4A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to: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=IDg9TVVrpq+dfJeFyjw/2BnAHX3YoQO88cP55qPELH4=; b=fLhEUtDut7ZdSNiL2+BUpuNHqSe4Jd7VPGa90lbEiEgvwwE0kxTQJiaZcltKtzI32c ZS4oeZisja0Um77WovMnj3rB23Q55LcosLeR2wrTSWTsfrN2J729AOblozluiEIzqdTa TOgm2fe1hVw26zdre+67V750PA/F9yKjnZ8QlfEN4NZw1kVrBYRH6+fUODerHTVUI6tP mehJLVV3SfVCua0Y2ItqUXwEn09lTbZeSiAm38mChPQZXyBt5wOfogaZeMqoqQrDPS+e VTWbX+CW5WZbWZbauMYfm3DwyE6oeEtcp9SIjY4bZDQcG+XdZJzZflaZ2LTDs/fiVbQy zRtQ== X-Gm-Message-State: AJIora//RfAiQTBQDrsSMsiUQSbuXEzh4jgsEmwn59bm7jsDIdTIV/uF qvPGIAhEr3sVr+n96w1LBdvzK0yx X-Google-Smtp-Source: AGRyM1tUzdJh19g4rsGrF0/Nuc+OQZoI0Xo+GfzSl4gYS93OS9JLEweDFZErKRiQIGUnatJHAnONJA== X-Received: by 2002:a17:906:844f:b0:72b:549e:a654 with SMTP id e15-20020a170906844f00b0072b549ea654mr1891888ejy.535.1657696617189; Wed, 13 Jul 2022 00:16:57 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:42c7:b0:43a:82dc:c2a2 with SMTP id i7-20020a05640242c700b0043a82dcc2a2ls218568edc.3.gmail; Wed, 13 Jul 2022 00:16:56 -0700 (PDT) X-Received: by 2002:a50:e613:0:b0:439:fd34:32db with SMTP id y19-20020a50e613000000b00439fd3432dbmr2871049edm.291.1657696615849; Wed, 13 Jul 2022 00:16:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657696615; cv=none; d=google.com; s=arc-20160816; b=CvagBQ7yFnHPopnVUWwUt+i06dNglG1pNXFrBSttAp2PJVeIfbq+as7GVzAmy+9na5 osUvDTNmF8YlnKRe968RUaqBdUnvs/nddKtXsp02guYHAGWYhqnPKwyfGhwVtuOrQn51 CtQmBKgvufK9vNJulOZbv2ELiq4mcqLc8oP8U8+wUPH8IJYyDolBPGEUgaCkeAkGklfo vG4iIH3cAaftQQ1FyIk052YyFDcvBgALijH8yHB6rCyyrKp3V/Sf/8awgyqYIVugo6c7 eQts5G5uE/ZkZnZXPF4AZQgU/S3K4iRm5mJcbOMMT5s0U3GWz2+r2zdoTCLKGoRIaWTj iEVQ== 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:to:from:dkim-signature; bh=IMfmcXJgLF3QxDo3zzC10MOLmmWWh43Nj1jajYbOo2c=; b=c8cGLW6j+dPzBUXglUxWiMOu4rXUO6EzB/n7DBJpuC33ynmBGyDn6V0wHsXIqazgTO VyIEymD2bk21PFNvNbBDljYzcBsDvuPfeAEzqv1CVj9NN+Rpy9Xe7AHIUfPp4Zjh+Mg2 P6Da05MK0OzZZ+Efpb482KSa2H5v36ld07iDcY0HLFvnIHgFjG8xxFuB+DdnQftku2as /pjcQU6wW9eTeId1w0m5wjKk4J5KSRXmiAhbGwyin2RZfvlY4Pu86FsaNG4BfWY0F8x8 ZcVRgL7bnoxi4MaGyU5aycCsJp/vNVf23qE9BrdzxbFFONu/xZHvXUGl0PmcvpCq0AF4 Ht/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=fizIRujx; 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 g19-20020a50d0d3000000b004396590144fsor4651712edf.43.2022.07.13.00.16.55 for (Google Transport Security); Wed, 13 Jul 2022 00:16:55 -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:6402:438f:b0:43a:cee2:a081 with SMTP id o15-20020a056402438f00b0043acee2a081mr2815913edc.298.1657696615550; Wed, 13 Jul 2022 00:16:55 -0700 (PDT) Received: from panicking.amarulasolutions.com ([2.198.242.86]) by smtp.gmail.com with ESMTPSA id z41-20020a509e2c000000b0043a95981050sm7414523ede.79.2022.07.13.00.16.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 00:16:54 -0700 (PDT) From: Michael Trimarchi To: Dario Binacchi , linux-amarula@amarulasolutions.com, Tommaso Merciai Subject: [PATCH 4/4] mtd: nand: Get rid of mtd variable in function calls Date: Wed, 13 Jul 2022 09:16:37 +0200 Message-Id: <20220713071637.275456-4-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220713071637.275456-1-michael@amarulasolutions.com> References: <20220713071637.275456-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=fizIRujx; 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/mxs_nand_spl.c | 2 +- drivers/mtd/nand/raw/nand_base.c | 26 ++++++++++++++------------ include/linux/mtd/rawnand.h | 3 +-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c index 05886fa025..29c25f774e 100644 --- a/drivers/mtd/nand/raw/mxs_nand_spl.c +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c @@ -83,7 +83,7 @@ static int mxs_flash_full_ident(struct mtd_info *mtd) struct nand_chip *chip = mtd_to_nand(mtd); struct nand_flash_dev *type; - type = nand_get_flash_type(mtd, chip, &nand_maf_id, &nand_dev_id, NULL); + type = nand_get_flash_type(chip, &nand_maf_id, &nand_dev_id, NULL); if (IS_ERR(type)) { chip->select_chip(mtd, -1); diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 02789789e9..06f066c5d6 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -4152,8 +4152,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]); @@ -4281,7 +4282,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 @@ -4291,7 +4292,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); } /* @@ -4314,9 +4315,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; @@ -4399,7 +4401,7 @@ static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip, chip->onfi_timing_mode_default = type->onfi_timing_mode_default; - chip->options |= (type->options & NAND_BUSWIDTH_16) ? NAND_BUSWIDTH_16 : 0; + chip->options |= type->options; if (!mtd->name) mtd->name = type->name; @@ -4432,11 +4434,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; @@ -4532,9 +4534,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 */ @@ -4724,7 +4726,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);