From patchwork Thu Jul 14 14:02:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Nazzareno Trimarchi X-Patchwork-Id: 2158 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 0F5E23F013 for ; Thu, 14 Jul 2022 16:02:32 +0200 (CEST) Received: by mail-wr1-f71.google.com with SMTP id l5-20020adfa385000000b0021db73f5818sf583387wrb.20 for ; Thu, 14 Jul 2022 07:02:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657807351; cv=pass; d=google.com; s=arc-20160816; b=c59McEmEHkIQEyBBXHNi6qZwNtdpZGLGRoqEfUV4dSc1OJ0Is7L6mhoeMCuFXf3vIR NA7H98DetpLsdMu7ifKqg+h2ZOsaQicwRQOjz5w4Zcqx5vaFwz/il61zhSqAvatn+Mw6 yTCjkEOIzpbyywy/UXPCV+/D7+JZVRmmLCn87vR2UXN7C2ASKXaG+7TY6ZT+pgBB5vn7 q1vP3zAG64TYrh1Pk5oC4Wlx9rWT4QjyafnJ3YdSjk3uGn5SlUoB5TeweP3zijuQFjHN cNsCEtNcS4FSEuhRahHDa0HEG+ZTQXqFi3+MKJfaSCCb+hnhFSodvLUiFmPC+dPlr3zA FdJw== 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=bWsYoxh4EGG5Y6a44K3Swhi9kgqogfWRi+rHQcZlZ34=; b=qo5pu3YzV7nuSOsPmsYXXYmjtC5Xpja8nsg8hnYcWDo+7mvq2UyRU0Ih+2iSnIWnMM PxW557taXrg0V1qamqCQ56JZ2Q0Oc3Uv38c8clsP6fdibzb+eHaeR+Oz6GArJ/XSHdRJ 9hbX0/bhQmdJh+F2x3JUGxNAu1GkzKqFWgVqKsjmLZF0VJJrrBfrnCD6yQ0GUtOtt8VS 1fmHZEDAtGE4THOaqF0Au/ECeXl08AFgd5K5vSIXSHxQBodFrfaWh6oV0lPsvY08KNsv ACsJQvZtdQINDGJ0RaeY0BzQ+Z0VRY8n84waxEzNw/ThGi1yQt46QrThKePlWIhHiujk iQkQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=l06w9BMf; 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=bWsYoxh4EGG5Y6a44K3Swhi9kgqogfWRi+rHQcZlZ34=; b=M5gdDnayzLwO1PA2bqw448aWvlcUjo3V00lyq+KCDbbvo9YZD+W8VZ6fvhjZOXU/ZU o/5Lpj4v/J+OmvGvPvQ2NfVsjRSTTTfqpBtzE9yDbuW5uyKyCaJrJOY9mN3L/EC0+N+b fqhyg9cHzPVqCzsASIpA8Zu/ouyqorJzBhzME= 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=bWsYoxh4EGG5Y6a44K3Swhi9kgqogfWRi+rHQcZlZ34=; b=7f5aamQNwr09sjFuWz4AKpRjjDDqz2sqjRx/6SzR5PEHSYgfXf6BTwiLAc6aNwdmjI lMEiZlmaTfzw7JVQuf/RMOaR7w9vOvy4kft37f4vUfkKi1U7iTInrlU3vfmzHzUWFMcf LSHzJsnpatOJEk62dPSWZ7fDnatft4SL3g3T+I6rZQ9EP+XaCRpj01CkGVur5jPEzrtJ ybEq+W/GBsL81v9Kr7PqmSjFwcu9CYk6wWhCwCY+hZvRwH5bSx3DKVzm6mzCCJPijWE8 eoTRLvYp64j/MGAcZI+GTS/k5zDQo0eTD/Xit76MtjkKyc0VPr/rpEpsbH/h9kYY0AFs Q8lw== X-Gm-Message-State: AJIora+D/ZXIeY0CUO3aETE7m6QfyEACkMvIMZutzUKim+gBIm6jN+OW 6qvbX6JBQJh/ncClfUPsw8OYSPGS X-Google-Smtp-Source: AGRyM1uzmrm0sDVcz0EHkuxzzoJr0unuq3A83PPRAkc6p6AlJdBT+bA8gLY/OU5xPkcesIU7UxaOWQ== X-Received: by 2002:a05:600c:507:b0:3a2:f6a2:7321 with SMTP id i7-20020a05600c050700b003a2f6a27321mr9270906wmc.136.1657807351847; Thu, 14 Jul 2022 07:02:31 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a5d:64af:0:b0:21d:bf45:f904 with SMTP id m15-20020a5d64af000000b0021dbf45f904ls110734wrp.3.gmail; Thu, 14 Jul 2022 07:02:30 -0700 (PDT) X-Received: by 2002:a5d:49c2:0:b0:21d:babe:e76e with SMTP id t2-20020a5d49c2000000b0021dbabee76emr8776731wrs.244.1657807350498; Thu, 14 Jul 2022 07:02:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657807350; cv=none; d=google.com; s=arc-20160816; b=oHL/wIDSwMbeoWYUW2qINtysygLEraIeJh/WEB0/c19TEfWqazurv1TvWqpUu1+Mld B62eX220vi+p14pyireQ2/UNlbLkSZrKvCu8f+AvpTgBJMxizmn0gFtUbF1qSEMbtG/4 MHMzWkeuaEmF8VF1J9O0W9HvovwGNH7gCHiw9L0ZHlwEXzNT/J0zfPd0uEEOYGjBWRb5 rI5Jm5fRIkaEZzvTtiA6oNHnG7fCHrMJjbiPny7NUM00uaYO3Aa8tvyrSoJCackozYcL g3hu/CHXfzK38PEi17/geOckkTE84cjPPhlGAhcrvHK/fiddFeA4BKnaANUOCwofP2nd /VPQ== 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=8r1tMsApi1aj9SR1CafRswHj8lBfItFykhvwhV0futo=; b=em5fLltZxePlcC9/RwqWvQeCDZVh4tEIsV45G8vcblBSn2RM4AY6s6U0EqWiPf0pOM 2hKfLG/kv3vIRytkpEPF+cxPgeUP51QnNRYOVKUGUxMh6TSfcBhcYV0AP64UwpDgI/3T 3JBeTyjgVN3492ITKAdbi1XTkSSZ70kJ1B4+frjS0uFrVYw3wrjySlvx3HPd4D+Ljp74 iWi3NKD9HAx2Zz+UjgubqYLqxbU7iGQn7/iMJSF/mZM8oUWag65GDpXDc62EpFyealfN 0axoT5xB76XZmUvizt5JFNirW72Gxxgs7RfOpNqq4/or9DJGBt9RfdAYJjGL6DrBgGKZ 8tcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=l06w9BMf; 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 k15-20020a05600c0b4f00b003a05105d3casor495281wmr.6.2022.07.14.07.02.30 for (Google Transport Security); Thu, 14 Jul 2022 07:02:30 -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:a7b:c8d3:0:b0:3a2:fe0d:ba2e with SMTP id f19-20020a7bc8d3000000b003a2fe0dba2emr7420221wml.115.1657807348318; Thu, 14 Jul 2022 07:02:28 -0700 (PDT) Received: from panicking.. ([2.198.242.86]) by smtp.gmail.com with ESMTPSA id k11-20020a7bc40b000000b0039c5cecf206sm2029114wmi.4.2022.07.14.07.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 07:02:27 -0700 (PDT) From: Michael Trimarchi To: linux-amarula@amarulasolutions.com, Dario Binacchi , Tommaso Merciai Subject: [PATCH 04/11] mtd: nand: Get rid of mtd variable in function calls Date: Thu, 14 Jul 2022 16:02:08 +0200 Message-Id: <20220714140215.444993-5-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220714140215.444993-1-michael@amarulasolutions.com> References: <20220714140215.444993-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=l06w9BMf; 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);