From patchwork Wed Jul 13 17:11:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 2142 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 927183F066 for ; Wed, 13 Jul 2022 19:11:28 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id j6-20020a05640211c600b0043a8ea2c138sf8726317edw.2 for ; Wed, 13 Jul 2022 10:11:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657732288; cv=pass; d=google.com; s=arc-20160816; b=Gv7h0I3mNolL+05xkpb6ypEd4uHPyqU7haSk1di/8J8L7SeMXiI0+O1oJlEOXpGJVN /8lQMHP295fWvBtYzIWRVTnqqKeyibJW8JOff0C2BC0yAqO0gP2tgc2Aqto0Rzrmd6mm 60UIoNNQWzTTw1lI3qfLjpPta1zTnr8O1ghUlFa6UHFFUMDIjEOrkdraf433hip80qHw PuabL4ot/keJA69WdoFUrprrMbUhnNkJi92h3/hpc6UY2Zu4cOhalsVoDOCiFhCsZR2V jZX5cjqb1eysX53N8Ow4wWM2Wb2K36jkaL8PS5OznPdRc9gGH4OezlqPZ+ZE+AJbKND9 Va4w== 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=LJVrge4oQgL9MWhThMeFyT3eG38JB1zx02XLhq1cbDE=; b=JQRmeyKQgoSCVJR/6qb4Jb0QEc3W46dTpKFOcIaIEunMEkR3JBs/zTfDhhrNQddhJD GR8iczOQSE5Cq7nXzp/yPrT9thc8x/9rIW0Guij3Iu4vwv6aeHz3kOd7KRVbdjVEtqRD rbY0y6Wq7+3iRMq8nXpaZmkgrt0dRlFFdP0B+aOZa0pjg8DK4QNrv80H7veifOl8eRlo MnVcoCq753P8Kdkz9zQAVNxz8RoqcQNiIWhrh+hyBiSXoKSr13rNmMXKBTMeZg0aPBaQ 6lFgzRRZEi07t+2HWXaRHdQBjIHEoKXRraVEwQNFZ1VBYO8n70htbGv3YM5erU0zdUtR eIaQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qMYbkzGx; 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=LJVrge4oQgL9MWhThMeFyT3eG38JB1zx02XLhq1cbDE=; b=Lp3iww6r3AMdTuhgwK2FLcZ65xEkrm+Xg1hoIDP80+VBIHWX5mf3rKqNFweMtYF3dX xvgLp/HnMycpQqcYqpr90Mkn0VKqmFCu/WjyzPH0EIgCNA2DQz4bHgL7FlR3hmYNKc9b MrixpjISuNvw3rXhQZ6Vommf6IGXJ6ftwq+Ck= 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=LJVrge4oQgL9MWhThMeFyT3eG38JB1zx02XLhq1cbDE=; b=TdR9eTQOrefQo6ux/1trX99u1WKCXQSN3C2s5RYGVMgPstUynOFih+KDiDKNWc5TaA qnrgYyFaqmwyO8teQpzyJUdJz6HTxuIh5a1I0QeB7hh8gzPOhD8EbKUE7arl/B9xi9/k hnFAF9fHdXnFVHCvczWrI2JjowZtc4EXF8YNcw+vT+WUSqjf1izysUW122JzPjrLjBY1 kJIsmYEZ5lsAMDDPeslnzk9El4YOEsiKllt9mMV37tIRWaH9fyV9pTD9rx6Guao2hZ07 EtW2q4r8XQu/HY0SOcd2uUOU7vnT2LLL3X5rXx9Jt1aGffLg2dBV025FUagPKl7pq4yE fV7Q== X-Gm-Message-State: AJIora+ESzz4tOdGdYGymslPoECYsEuZLFkzHAwmDMLZHFFRiPLTDoVN w4OVvokR9AslrvJongP02MWzGl+u X-Google-Smtp-Source: AGRyM1vF8/qjcjAgBhPz7JSPKhK883aKnKLjW/Gv9p8xDJZNwFgcUZFvgtEn8JHlCv6tXgPt7fpMbA== X-Received: by 2002:a05:6402:348e:b0:43a:953d:ade8 with SMTP id v14-20020a056402348e00b0043a953dade8mr6237078edc.135.1657732288217; Wed, 13 Jul 2022 10:11:28 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:d0e:b0:43a:6e96:4ae7 with SMTP id eb14-20020a0564020d0e00b0043a6e964ae7ls126975edb.1.gmail; Wed, 13 Jul 2022 10:11:27 -0700 (PDT) X-Received: by 2002:a05:6402:27ca:b0:43a:c342:b226 with SMTP id c10-20020a05640227ca00b0043ac342b226mr6386090ede.342.1657732286855; Wed, 13 Jul 2022 10:11:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657732286; cv=none; d=google.com; s=arc-20160816; b=IWQF90fK4aTj3soqF9BvZlhGTdD/3cSOmzBwTTS0oQ0mLZGeNxaf7jdmItf6NJqSJN yhazzqCuPNKTROJttkbtjsxD+IFYMzNidgzXKoa4Rb6tm/L4yw9lRjDMPO+HAIqg48Mp Km1iKJNTxMEl/K4qOKftr9oQh2CtcOykHxiQs6WCmIDJqlC28t/3evcBPXftngLDe6R2 CE8vyjyHS7kWIHZmAJjSbGkVJEapkWwRQ2/BcNBuW7QB/tXkUbhZMyitLCv+BM+ZFW1y KzmDNKwELxg+YucSfZbbTUqAOpfhRFGDKKj3H8DDTfWhmbvn77tMA7E+fmreIh8Tt6ua BKyw== 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=jQ5TC0H2CtHvtROfYf0q+4f6r+UCA0JDylr/aUnbdhI=; b=BjWo6xNha2OZHwsu1EDyKC+1YmVpOy8OgmyjECncTfmXHH+ejCi5VkPHuYoUt3SJKg nOOXoiHV0oHWINhZ0ThwpQ4cPYsGTAnon19skkLbykzkOgeagq5CQV5B6yRT8DRQNGq3 ZXyM7Fg36bSz3nO47GY2JO6OHcuO9S5TlavNrCysjez7ZRyGGkcGAayoaAgzGvUfkNuJ woZXpUXbXPNSrxEN6V3q0DEguPn1R4/437aPmnV/j7h/3qbKKy+Um+Luy+TMZOvxGbU/ 4Q5dt63ECOWc17eEa84IQz8pK2ZQz9ipZH60Se0UANy47IM1AbRMfgdr3XEVL7e20Vw7 i/5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qMYbkzGx; 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 qn21-20020a170907871500b0072b17278302sor4142788ejc.78.2022.07.13.10.11.26 for (Google Transport Security); Wed, 13 Jul 2022 10:11:26 -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:a17:907:75e9:b0:72b:2ddb:41fe with SMTP id jz9-20020a17090775e900b0072b2ddb41femr4536647ejc.329.1657732286160; Wed, 13 Jul 2022 10:11:26 -0700 (PDT) Received: from panicking.amarulasolutions.com ([2.198.242.86]) by smtp.gmail.com with ESMTPSA id lb16-20020a170907785000b0072b36cbcdaasm5218168ejc.92.2022.07.13.10.11.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 10:11:25 -0700 (PDT) From: Michael Trimarchi To: linux-amarula@amarulasolutions.com, Dario Binacchi , Tommaso Merciai Subject: [PATCH V3 4/4] mtd: nand: Get rid of mtd variable in function calls Date: Wed, 13 Jul 2022 19:11:11 +0200 Message-Id: <20220713171111.337338-4-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220713171111.337338-1-michael@amarulasolutions.com> References: <20220713171111.337338-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=qMYbkzGx; 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 --- V2->V3: - Adjust aligment --- 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 d9024432b7..be1a6738c1 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]); @@ -4283,7 +4284,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 @@ -4293,7 +4294,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); } /* @@ -4316,9 +4317,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; @@ -4431,11 +4433,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; @@ -4531,9 +4533,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 */ @@ -4723,7 +4725,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);