From patchwork Wed Jul 13 11:06:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 2131 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 2CB8F3F066 for ; Wed, 13 Jul 2022 13:06:27 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id b15-20020a056402278f00b0043acaf76f8dsf6750477ede.21 for ; Wed, 13 Jul 2022 04:06:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657710387; cv=pass; d=google.com; s=arc-20160816; b=s221L0KXZngD/lhCuhStjhUK8HLhFDyo00Ls27eiICSdU8pTL322xE/joKZeJHq64X RqSNX1SK4dryyVn7bcOl5mlquA7YYEiDySGHLJCEAXBgk78OYiq+k7AafV9NlEsOFVnA J8nRxPZ8oh7cIQTNH2t+ts53bSSDhUY4WFAY2o7zTl9W2Ysz/pcjzvjoLu4Ee3tGNt5L fuZ5NtZ79qZxxG50OTmBBPx20xhf2rFcN1WTlAPXo29pTHaPuNQV0rMRE+pCnIAlfnGc yFFZoyRt5tr1/hQQb/9eUnvI3XDBUMEoaT6ROoS8J4ATcc1/dtcYX5T7BCDNiDO9C3DD GVwQ== 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=Ub9GlIAwsfk/NXblOfvbR+CjNnnC6msfiCklC7i6EF8=; b=qehiIF4zJF5Ok7f9H/NBB6RkyvehO5AyLfzvIHw/MzKQ/JjF3jiS0XdbgqmWDmJTmm 9+PODaK8O3CEj3Fni08oxrAh3L+4bdy0rWxApeHMkdGcWLFTbdAB7leBwfj6JrUy0xDC VfsylR4QzhrIqCiHD+6Q9u6XwvrEUECyZMDvBu6HmayAbjbzQPi7txCLpeRJk4bdmbqq 61EuFpvnzPGcmfNyVOAQ1CgThkpejZ2HxPclelRqVCeUsX4plcRs6tbzRm4awWm5ig9o hLI9FFulVfE4Q6B/pnza874/PfsS3E4NYgy54ZKMiTOl5bmvhTOnX8Rhd1uxN1DI+BO2 8z3w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qmQSSeao; 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=Ub9GlIAwsfk/NXblOfvbR+CjNnnC6msfiCklC7i6EF8=; b=Z8D855fjzLYUKzhF+wyvmYY/eRJOB+ofCtcmO0OZOrsxhtExEoQBQUER0JY3nY74C1 YoIByq8r98F+cc1WfU3UDOBi6RxoHXGE43/g7UQvVcbfCsNjiMv8/nDq/oGlWzYAG+S+ 3m5WdqOickbyR7KkevpZEaHNkEJEXaGcKek5k= 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=Ub9GlIAwsfk/NXblOfvbR+CjNnnC6msfiCklC7i6EF8=; b=lko5JutATJKq5aTswc+sHALF+kdi06F1sSZfXrVFKcaL5ME+jIhfJG3mdtoVW0IQg3 lXYGA1dfca+Q9MtpK0ptjgpaVseMPoYGZVHKrt99elwtCBhTVIlgC6lvQDK5c/Jqei3h BUQa8YXmA48srI7jtpkcC3PkCgd37kBspoHivCdywYSoHzPO3tmZhuCkstrzCNN8iv3I uQP8RCwFPeeTC3WGSYlraQdEinCKJfG2TSVxp+0uqdrh3oGafNAD4Uwq+2iIWTkSZzCg 1bTVlnUuZWxexF+LCTz43HtarIziNDHa+69XR5Kw68GGomj+Xn2zKR/MSGHO+Jd/soPZ CyDg== X-Gm-Message-State: AJIora/+Q7DOpseg63iVqJtvtFAO98CpLdRSt794vK9TpvUrMlfmJQ+B x+DpquTWPo8KtznVd+9uf4wCBK3X X-Google-Smtp-Source: AGRyM1tPDRsHbzPtfxgquMyApEn9SIiQnAKLQfes9edS7JhnjNyP5X0VYsKnI5SUmHjDx4LSgiux+A== X-Received: by 2002:a05:6402:3681:b0:43a:7c29:466a with SMTP id ej1-20020a056402368100b0043a7c29466amr3985335edb.367.1657710387002; Wed, 13 Jul 2022 04:06:27 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:70cf:b0:6fe:d027:3c1f with SMTP id g15-20020a17090670cf00b006fed0273c1fls2841711ejk.2.gmail; Wed, 13 Jul 2022 04:06:25 -0700 (PDT) X-Received: by 2002:a17:907:c06:b0:701:eb60:ded with SMTP id ga6-20020a1709070c0600b00701eb600dedmr2989506ejc.178.1657710385630; Wed, 13 Jul 2022 04:06:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657710385; cv=none; d=google.com; s=arc-20160816; b=Y5ZiHLAqWPvQrhpVWQ8gMxQ9BxAL8EfSXsQBVL6AX5gU7WQh7U1Hxvwf0z19CInDij 3aHE+KwfQQWEuqvkCa+r/9IyZXmEXTrWR1mCiG8B8geLOMRllhP0zT4WtaGMyTHJexEV qTSATy3hw9BsTes8KB6L/EnGX3VGWS2PVTLLxzuuXDu8SLNejvhSzDHNiBk/kbXESdkf i6oWDiaHV/eLWFfZizX794iDlt5eJBV1GJsEr2aqmoQe/7K1LS/+EVutyCWAC2AQQZlt z5pihuyGA1cuDFZHeHEurIr5yCBQsVTZDcmQiyHQEJPvrMXr5t9xkgMIFGUetzACZ1YL AHGQ== 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=tSANhVcCLmGJcfXnFUh4H/uYqqsHsinco2iBfELb9xk=; b=MQzSU+O7USSfRWwpT/grA1ME3cnv9RR3kXQ52QMEbTrVOp9UNP9DaTzumuJmFz/Osq mUdeEPIb8nREijjbYH71TH6rZ+lMuPzxsCHDOj1UIBky8fGUWRDoFKmnGtvLe+tyGv7k qWGsGv4JaZhryhxoQbR4Rs7FOIp926J5K1tQ3nNuGedvv8yILcnpM2GaMz538s9DXJv/ 0oJHSa8uqsQEdJZNHxKL0at27iiXQc/bDS8gGXtYvD0fvjVS1xG3mb5x4pRj3egZlF+G DdgHkziF5r0F9W5mgoZ1rY09BjOV+zzglF4EUJo4RE3Zh8/nowopEHbg+7yRZ8moYZ6p fc3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qmQSSeao; 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 gv49-20020a1709072bf100b007033fef81a4sor3831329ejc.56.2022.07.13.04.06.25 for (Google Transport Security); Wed, 13 Jul 2022 04:06:25 -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:9b8a:b0:722:e50e:2a6d with SMTP id dd10-20020a1709069b8a00b00722e50e2a6dmr2949573ejc.724.1657710384882; Wed, 13 Jul 2022 04:06:24 -0700 (PDT) Received: from panicking.amarulasolutions.com ([2.198.242.86]) by smtp.gmail.com with ESMTPSA id fg16-20020a1709069c5000b006fec27575f1sm4830767ejc.123.2022.07.13.04.06.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 04:06:24 -0700 (PDT) From: Michael Trimarchi To: linux-amarula@amarulasolutions.com, Dario Binacchi , Tommaso Merciai Subject: [PATCH V2 4/4] mtd: nand: Get rid of mtd variable in function calls Date: Wed, 13 Jul 2022 13:06:16 +0200 Message-Id: <20220713110616.305444-4-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220713110616.305444-1-michael@amarulasolutions.com> References: <20220713110616.305444-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=qmQSSeao; 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 | 24 +++++++++++++----------- include/linux/mtd/rawnand.h | 3 +-- 3 files changed, 15 insertions(+), 14 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 d58451196c..f666d8ef5d 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -4156,8 +4156,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]); @@ -4287,7 +4288,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 @@ -4297,7 +4298,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); } /* @@ -4320,9 +4321,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; @@ -4436,11 +4438,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; @@ -4536,9 +4538,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 */ @@ -4728,7 +4730,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);