From patchwork Thu Jul 14 07:51:24 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: 2146 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 EF78C3F013 for ; Thu, 14 Jul 2022 09:51:43 +0200 (CEST) Received: by mail-ej1-f70.google.com with SMTP id gb37-20020a170907962500b0072b820af09dsf431746ejc.20 for ; Thu, 14 Jul 2022 00:51:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657785103; cv=pass; d=google.com; s=arc-20160816; b=XiOAVovKd1bUtd6r4HTR9NbvUqnGXvbahZIzigsvCywVh6fd2F6kNcs3pDp5m/bHW1 BaCgmsxHgkcTEF9hlvOhj2gyPedZfhq8E2vfwLEl/PSA2B+Gmk/RvVMFUXSegn+SRxcr sWrJPbQtHAQCLXTOITdCOkg7HzrEpWXnZIdVGadLSR6TSdtNP1c2ptpEObb02iwlBQM9 Z0niQDK8ewVEbyRC3oSM7PYFoV8REcwE/GNWrk7QKUGrvW29rDE61yzWnsKFg1p8HVo+ mRK0JP4/6hDv3M7Kd57/TPRYw4x+vCi8ktyzMcLw/2vBzm1hzDcvYM+UgTiW+YsNGmoi AgoQ== 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=aYPMDydZmLi411lOWXdUZW3qBs8z8UWYv5Ae3OedAHI=; b=gn3r9VBiHNHg9GIU+qHzefgzWwmMyu0sxp6JTj7o2A+8olIkF0IFt2ZkpdAJfYoduB UX6mxlImxusMrofpahGf5mTYFszzuiZ4BceMqs46KobqjwcLqLBG7D+pHF/M5BCV0vVr SRzGFMtH+kHaJHX/1E4Sv36VWdNnTs6widxJhh3pBkDF5o12fNgYDK2LV+KaaCLa7T18 Rr4B1ahZH/N4uF5aePh8y5NdTNE2XzpzoSQUi9NXJIMlASkLZ6k9WXW/ZfB7ibsXPozk t/Vhpf8oGQbdW9mkMJKHZqwRIsMtsCpXHcGWxtUla34L+tVe/uMWSBkTH5FjvfI2mhfu 5yOg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mEpoWws5; 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=aYPMDydZmLi411lOWXdUZW3qBs8z8UWYv5Ae3OedAHI=; b=mGlUcc+OPeD5gezHeh+YasHQI5GAPrEaG/A6jI66WJZdJ3IQS0tvc1gBxujJnV5aPj dfmlPPaGUR1JbjCQ4nnU8VgKNctDyKiC1LFTlPR47D6X9QPqkx6IO6RdemkSSIt+Z9u3 zhtftB+kIqDyxseVwp1/KVl4ZSs0nWz1ryI1I= 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=aYPMDydZmLi411lOWXdUZW3qBs8z8UWYv5Ae3OedAHI=; b=My5Yj70CvrfAvuEYimI92/HyDhcDbuMYTagiGwbyF8tjXR5ZHehgLyTOFJigbw+jch uZBDySRLN7zVQqspd4vBX3L4hR5HvL3j1Dd2L5kjlrQtVmLDASlSuGQSIaMa+cabUpvM 9/VAXcIvJTlcBOFS4HqC9IFg/MSIpEGJVl1OPQmFKMX8JLL/AWL+x+aT6OD62IdCiG4l 3M33SkRulNRUX9WQceN72ePkfmsJlvCTzE+a8fdwY6WNd42P02eCAX8G2ti35pnTM+YB lPCrrYKSC3swXzZ8cPtOI3EsAgUVtWCy7ACuDYDS2ghVTB+/xKHtUGPN44mWdHN8r2Uu Elow== X-Gm-Message-State: AJIora8IyDB310U6JZUOX+xwxL4lMouCd9zsV0nZfcO75dMh41bvaFsP Mho1zaVwWDP0XQMX8ANfcEzWLkJA X-Google-Smtp-Source: AGRyM1txX5gPjmOa1R5YZflz8qcSeouHdxh08V2EUQHM+FSp3cmzGBTxAavvkpCoFZVEb4p6agQJxQ== X-Received: by 2002:a05:6402:5510:b0:43a:76ff:b044 with SMTP id fi16-20020a056402551000b0043a76ffb044mr10736344edb.197.1657785103799; Thu, 14 Jul 2022 00:51:43 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:907:9603:b0:6ff:232a:2406 with SMTP id gb3-20020a170907960300b006ff232a2406ls4180959ejc.0.gmail; Thu, 14 Jul 2022 00:51:42 -0700 (PDT) X-Received: by 2002:a17:906:844b:b0:72b:54b9:b97d with SMTP id e11-20020a170906844b00b0072b54b9b97dmr7664226ejy.229.1657785102443; Thu, 14 Jul 2022 00:51:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657785102; cv=none; d=google.com; s=arc-20160816; b=LoqjPhenqaut8Yw1TD/SVWQ9F8GqQRXw79G5uhTTllNc0YyBwn8Jp4Uy2No0v/Hp1U PT32ergKQlxcIztA/ttHqVV0vFh1WhGmjMglQf7Qh6LHtrs1luOswxykiaoE2p1+UbiZ et9VbTAuvelV80BgxcCmHhMwTlpGXws7Q4CzEGoka7VIOO9kOrNKSU38eLzTHWZl6Qs0 Ufy5xKcYaax+uGfktcimclBMuaYbqGYX1xiMW3BbWeRS9FAnOybq6iqtcNfuLaAUr2PN F60qupdzCsXCIVwebCOeBCtDNOwyRH85PZk7WZTOJbj1+G6t3T55o+DhpKsZ9bsV8S8n oJQA== 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=L+7ysmT4HEHTHKLZ7Cn7atYvU0yakssT+CAnPDUwQbY=; b=ZlY1AkrhQKdqzQb0DSi7XEqsMChBLR9M5iHTiRUBmUBTpOzWC1VIo9ncIr94OUKVSg D81u8iC7k6rE22enXdzQoJV6x26GJTJhQ1xKasLAeO3NQzM9G2oZEkxpWx3Q+kEAIMHv FhAYUwb1Yh3E/d7IxwGwtENk7acnceB89pl8Wdp1JYoDgPLXrPtfYNIdCYWZyG5tFPHF 9Nk7t9QonVL1ReNRWvX6ZR1cXqPqb1bRRHrjSi6AgHnxUuCHVKhiPGnJLdbnFpZjMe4G 0jFuXxSltDvHbNM1VYnLFscSAThJSoz0s8Qes/inMCd8qAGHV55xK/JqWy+WtV5kJ5g+ pj1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mEpoWws5; 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 h22-20020a1709060f5600b007263150e3a6sor285430ejj.51.2022.07.14.00.51.42 for (Google Transport Security); Thu, 14 Jul 2022 00:51:42 -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:906:3f51:b0:712:3945:8c0d with SMTP id f17-20020a1709063f5100b0071239458c0dmr7487955ejj.302.1657785101736; Thu, 14 Jul 2022 00:51:41 -0700 (PDT) Received: from panicking.amarulasolutions.com ([2.198.242.86]) by smtp.gmail.com with ESMTPSA id r23-20020a170906a21700b0072b616ade26sm369252ejy.216.2022.07.14.00.51.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 00:51:41 -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 09:51:24 +0200 Message-Id: <20220714075131.411548-4-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220714075131.411548-1-michael@amarulasolutions.com> References: <20220714075131.411548-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=mEpoWws5; 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 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);