From patchwork Wed Jul 20 16:22:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2205 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id ECF0C3F046 for ; Wed, 20 Jul 2022 18:22:37 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id h17-20020a056402281100b0043aa5c0493dsf12408052ede.16 for ; Wed, 20 Jul 2022 09:22:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658334157; cv=pass; d=google.com; s=arc-20160816; b=hpeCuRFkJfSmviMe2ojJkFIiBxQ/mZx5TF28VTd3m6prEGCWOHYZDiBKj+aJBGSi+u 2qWHDWNYS7zUxXcJeZmHnbZtWC1LaBWXdeWM+efOOOT/xP4CmQWBfuMcXJ7E5q1M9GlB peCh+Tunen/Q5+XS7p5BJXpJzNvJx02KHtM948dOU+pLcBBfQgnsJyJoZ333t/reSDG8 3OA9NwCJLZAeJk6ZprXNKMPP018Wp/fhR72YzNBG3cyP62EFyrbIBrVVvOrcX3cqjAHS cuVpWM8slWkqXpK9+30/PKCaFpUm41ScCUUlSqNgDwnxShQ4VAKefXHzgWCVLm8Dp5Qx Be7w== 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=djK++dJll2yeRzygcIXe4uN8lcYBOz9X1RNaPNSbU+aeZ8Yg2cEKk7O2DJ2jB8N3RB mloVzmLR8R5/8bB1qg0Gr3XcAFDBujTKgsvtdxAiUcnt7VsEDHw+oEF+e1BQvHrOm+jY Sk5UXufHXCKfu04+C0jg8jI30zCF7XEqiYCvvDORxs0acl2qaLPTgSDLMlKzFCbLeynB puQOQxcD+VARAykJYcS5dP46/Ho6fzq1d9rZoJVSqaN19s2TLvHeFKR57Nk8MKkoApwS YIaQkpdbgXfatX0xv2rNT4qOSqK6LGrdj5a9fGoBDuuYpgaS2xJRKDhAFJf7BhVj/Q72 Lwcg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Wiuy0z9c; 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=r2MSnws7hya13nGbhUvUn+cwsDSODDUytOvCLXMWLdpORcqC0LkktvR2IuDhhfiV6f wGONbmIA9W/3VBedfyUXcxRbbWhZIA+tk8wQHKEii6b+M2lXOhp3NG7RrStdDi28EMbS m8TxSH3NW8yxOBNiHfVPnfaRpz4COtiCClFe4= 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=wtj8vxiFs3bnd84934IyRnaTtjvnOqhJCEZfZ2IBpTNZ67VIWcF7RCQSarHNt5J8+w JGRvBjX5TJomj1ipChz/lxGjA6QeA4wdehKgZPzB1AX6iPOQprNo4u45qaLezzvFmEq7 LruhdirA22iJ+l5bG0elLLKqfE7V+nrzLWZR678MDf40dBbfyW8CP+i113773z1Dv3tI XAB0/iL3XnfAwFMEpZ27okApgQhzFaMs8j2C60jwm9GumSfIo4LyMIII122JJqAn+f4X uhBbeO7k4datPlxYDuUZHwh1XvjDQDp8t+lRDKYt5EtQ1DYaME3bI5VyMXMbu+uRxNIY ai+A== X-Gm-Message-State: AJIora+6Yo160p5oyvtdfgiQCXlFeGFYck15gkMm0nUfK9+HSh3SE/YY eHYRtK+dsENHwLssR2HFGVz4qxlE X-Google-Smtp-Source: AGRyM1taKVpajHIkY0QvhNYb62CCFr9U2Q/URi24ndcW30WpocDQXBP/LxsDkA0v1IKb8YTCb9Zlvg== X-Received: by 2002:a17:907:9613:b0:72b:68df:8ada with SMTP id gb19-20020a170907961300b0072b68df8adamr37326604ejc.31.1658334157633; Wed, 20 Jul 2022 09:22:37 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:430c:b0:43a:6e16:5059 with SMTP id m12-20020a056402430c00b0043a6e165059ls257301edc.2.-pod-prod-gmail; Wed, 20 Jul 2022 09:22:36 -0700 (PDT) X-Received: by 2002:a05:6402:4244:b0:43a:ded8:563b with SMTP id g4-20020a056402424400b0043aded8563bmr52813677edb.222.1658334156671; Wed, 20 Jul 2022 09:22:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658334156; cv=none; d=google.com; s=arc-20160816; b=vohNEXPfqgv2iXicCYu9Cv+znP30r5nStqGoJxXvaWgU61XyyonLPlKL1RkYkuJxmO F0ojKwpOeQ2/7VMSCAkn3IhwsVaTOqm+Y/bMGT7DdqyX8OQXyp6YEB5dimiH9kImkKLo oZbMGBiVMsLSIBmI/W95b37bwZTrwZmsc5dwy60I9N1+oNlccqh4KWDbpSfwsFcBrs3L YkrUnko2n1fgvy/+8TSGj8EnB3xoulMO0Z3MtdKKm7gz28D6iakLkxAkGtwLL/YEaMvB MIGP/BdDfUNrZnLPPjPgRNT47XTgI/cM/PEc1tPkMPSS/OyHnNj9DdOpoTcxcJZpeAog 3u1g== 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=cV6ais8SdkHTxF58suhjLLVj9agXQs743TARIGaKl8fJk7UnbipoTLFKHJmuvMDdPc l++XfNfrJ8YZoeUbA5jbr0Bs6LihA0Dvwv0uRUdQ8004VS3F0y/CJlU4k6WdI+HXb7vu Y1AR+3GQ76Q4TTPep3VGnAY9zt4AYIcFMGHXPxzdrA0Puigu8KuvA85oLju/9PS/Gtz+ DtFoXVYwXRDM11k1/UjrzaV33//tzLkSB0t+aY7ZZgQvjaa+F4h+nzvP778uXT7Ffdud umlL8HwkB5y1JXV1STtUY4XzCL0sPEbpnIqNcbyHkzpFr3gdDGUaw1vAMyhYS7i0pKzj W9qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Wiuy0z9c; 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 i16-20020a170906699000b00722e9ef933dsor6434616ejr.79.2022.07.20.09.22.36 for (Google Transport Security); Wed, 20 Jul 2022 09:22:36 -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:a17:906:106:b0:722:e997:a365 with SMTP id 6-20020a170906010600b00722e997a365mr35966158eje.169.1658334156453; Wed, 20 Jul 2022 09:22:36 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.pdxnet.pdxeng.ch (host-87-14-98-67.retail.telecomitalia.it. [87.14.98.67]) by smtp.gmail.com with ESMTPSA id jl10-20020a17090775ca00b0072ed9efc9dfsm8057839ejc.48.2022.07.20.09.22.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 09:22:36 -0700 (PDT) From: Dario Binacchi To: michael@amarulasolutions.com Cc: Amarula patchwork , Dario Binacchi Subject: [PATCH v3 04/13] mtd: nand: Get rid of mtd variable in function calls Date: Wed, 20 Jul 2022 18:22:07 +0200 Message-Id: <20220720162216.2397616-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220720162216.2397616-1-dario.binacchi@amarulasolutions.com> References: <20220720162216.2397616-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=Wiuy0z9c; 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);