From patchwork Thu Jul 21 06:44:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2219 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 6FA5744190 for ; Thu, 21 Jul 2022 08:44:56 +0200 (CEST) Received: by mail-wr1-f70.google.com with SMTP id t12-20020adfa2cc000000b0021e564cde06sf50797wra.17 for ; Wed, 20 Jul 2022 23:44:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658385896; cv=pass; d=google.com; s=arc-20160816; b=Rn9IgcW7Ap2XAWStOmCpD7WqvD49a5tmV28P2O+pOW6mfwbQqqzBvpvOyvCKBUxW28 EAsfOPULxWs+NViqkzEek3iftYO4Fb4zyegKaWwfruyVQ5u2lUsYlDgAvqPsGaxA7Ftg RhuR/R4+qY7XKxjUMZNpK+sqjOLr1sTAu+b/4Vt+9PauB9Kz5Nc2Uu9LOmLfz9M23h2J ai8LT0YvX5ZXOpwl/nj0/U0NIgJuZJGwJJZqz0QK66XBNUiE1qETLNU74w8BO8w6MNA5 RrAIC1+eXoPVAJgSrVuB3cMB8QeXWFwoiu38mz7tntwF5d9V9iHph3mIgJGJJ+ahiYWd QfpQ== 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:cc:to:from:dkim-signature; bh=PNnAaAD0MVmU1Dt77oP+IW2haOw8iUHhG6sZ4ltHmqQ=; b=P5fVtdxAjUq6p/x0CfGxnDpS21TsRxiED3PAC7zDFZoQEwil+wksm5fU1cCSQBgoTs cb45BDEa9OpfaZcJ02iErV6m1p+tVr9MSKtNW/PJOsgOKpXMDBCDDKEn/C+5beRKlTeQ Yn4pMt6bZwO4+TX11iZ1nfMrXyiMYwy9vbHsfgaHvnv5CIAURHpl3lN7kP70jHhhDeu4 V6yBPsoUxDKum+hyGouaAzBcIf2l4z1DmaWKlNz95FXu01Mnrjvuf2IN9L8jquLCKgDP 96FVgHyAFfQe8z8Bb6ElbrL96GFw62en12OAPBTYnpW9XrxHkIyQavZmYiPo3Mhd+B5b bqfw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="q/C3C0Y4"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@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:cc: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=PNnAaAD0MVmU1Dt77oP+IW2haOw8iUHhG6sZ4ltHmqQ=; b=Xrihgwisa/uDxHxG991tmgkyu9iVpmMBkZr68jhUC/z1BswQvW42Q5c8FIATmXR9rY T09p1+sfN1ZS/FdBzK+4J5sgOQckWIyJduRggCF98+qMATB/sgmlydpWXvtHZss5pFZH 2XTEbLclX64acicaivOVsTfa8KN89j6jgis+A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc: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=PNnAaAD0MVmU1Dt77oP+IW2haOw8iUHhG6sZ4ltHmqQ=; b=18ZZw4y2BKRG+jgg53AfRFzyK0T6S3gdoxDgkWZYYvn5KEvAb4RCvpDWJu51ZLw2eg ANlGZ9y43MQiXqcDxX6oz6TiiduhFUEX3cKhwXfXSG7+hOPo0t2c2Tzv9Gq1rbp70vX0 KUOBpZwwnlbjGeJfNcAVDVVq9e3sp0qyvCVv/fJSDxtuuZbw9zjBLUlZPP12rAh7yMaJ PAh1VStItb5No2uQrswQML6ReSX7xz9+r+wi4YC9OHy7ZhqFKrXMWYX547fRtmcs4Zy4 uBvrYkkKrOWXnymOL58cK7bL+zsuUXrJaQiBnJy3FbsQKGoFx9x+zlxWoYPR9hfMQzxA LB4w== X-Gm-Message-State: AJIora/rfMyYD5Y4wwCR8eIfyte/Jq0FyhNK/ylniBLUO6CK5zbfhUll OQwgQ6AY2VhhPm6aGx3z/dUJmfZm X-Google-Smtp-Source: AGRyM1sAZmttBzBZ+5CK4kmuL2vbHUtcp2c9gKL9CbpPyaV0nv/49OZVakuuU5fBPJ0BIGW2cO9QEw== X-Received: by 2002:adf:f5cf:0:b0:21e:2ebc:4126 with SMTP id k15-20020adff5cf000000b0021e2ebc4126mr9919710wrp.195.1658385896178; Wed, 20 Jul 2022 23:44:56 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:adf:d209:0:b0:21e:53a1:af5d with SMTP id j9-20020adfd209000000b0021e53a1af5dls243689wrh.3.-pod-prod-gmail; Wed, 20 Jul 2022 23:44:55 -0700 (PDT) X-Received: by 2002:a05:6000:60a:b0:21d:9451:e91 with SMTP id bn10-20020a056000060a00b0021d94510e91mr34278444wrb.73.1658385895212; Wed, 20 Jul 2022 23:44:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658385895; cv=none; d=google.com; s=arc-20160816; b=eH4gsLoS+1m1sWpfU6ZyfP0bSlCOrmL6xX7CmdzhwSEn5tSlbbn/YIQpajHToA2JbV cEHRAICrWjtgPrHFIUlg7WcsBaY8Zg0z2kBxetcy7RuhUBkJePGC8UM2dSFjGEazdL8V Zu2Nv04QSi4JVe50zAHy3VFiI5Kmx8FjkVPviNym0QHyiTmPp0slM2yHLOFOy2b2qgyK E70+jpHwiaycKwF9vOcqJm5Bb1sQCWJGpxr1HDXfcRueA1p/k14dcHBfVV5bnOCHoOM/ ZKoYHNTsw3wPc+FhsUb9AfqY86SDnjUWQkjI29rtyALBuHE57xiXvMtP9SudiGHytPIn CIhg== 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:cc:to:from:dkim-signature; bh=/Qrxi4xtJKkwAMXpR1/qDY76Jr73md3YvbKXiEzew8g=; b=gM9C81R9K85EWoXFykdPcl90oh1IOkmiUfFhDWRI8TYEZN7NVSl0MpHYSGH45X7By3 1BSQnvZ99tDd/xyKA8STgMPn8Gm5569IG7Z1MCavKCdI3uM3aK4U6fxCJvp7c5Dpn7Tt GZ9KUkCFnVU9dYqozSINmXs6+OT1Q1JFpg8KVXdq+MyuiMcdMKWWBUNOutlUWrjEL/z2 pxgPwzEOJJd3CXeDmbRE2rAwHPwFJOUy+47i4fF6uEX3PBfrQcw6mnZ7ykooeK327tNN t9UqzWxnrQztLN90gwgEatBTAEcTMQHCWmG1rDiG106uiuCms+mP51EaWa8j1LpFCB8U ZqTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="q/C3C0Y4"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@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 o7-20020a5d6487000000b0021e138d93a1sor409113wri.74.2022.07.20.23.44.55 for (Google Transport Security); Wed, 20 Jul 2022 23:44:55 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:adf:e44f:0:b0:21e:4ee5:eac4 with SMTP id t15-20020adfe44f000000b0021e4ee5eac4mr3604892wrm.485.1658385895000; Wed, 20 Jul 2022 23:44:55 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.pdxnet.pdxeng.ch (mob-5-90-140-42.net.vodafone.it. [5.90.140.42]) by smtp.gmail.com with ESMTPSA id c18-20020a056000105200b0021e4f446d43sm903711wrx.58.2022.07.20.23.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 23:44:54 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Amarula patchwork , michael@amarulasolutions.com, Dario Binacchi , Patrice Chotard , Simon Glass , Wolfgang Denk Subject: [PATCH v3 04/13] mtd: nand: Get rid of mtd variable in function calls Date: Thu, 21 Jul 2022 08:44:26 +0200 Message-Id: <20220721064435.2456601-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220721064435.2456601-1-dario.binacchi@amarulasolutions.com> References: <20220721064435.2456601-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="q/C3C0Y4"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@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: , From: Michael Trimarchi chip points to mtd. Passing chip is enough to have a reference to mtd when is necessary Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- Changes in v3: - Fix code style warnings raised by patman. drivers/mtd/nand/raw/nand_base.c | 25 +++++++++++++------------ include/linux/mtd/rawnand.h | 3 +-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 0900e6dbf9a6..145de22be852 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,9 @@ 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, - struct nand_flash_dev *type) +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 +4440,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; @@ -4539,9 +4540,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 */ @@ -4729,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 57fe7fb47bd8..d8141cb4d114 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);