From patchwork Fri Mar 15 14:14:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe REYNES X-Patchwork-Id: 1057077 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=softathome.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44LSVN72wkz9s3q for ; Sat, 16 Mar 2019 01:23:24 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 96095C22176; Fri, 15 Mar 2019 14:22:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=KHOP_BIG_TO_CC autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id AFBB6C2218A; Fri, 15 Mar 2019 14:22:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D15A0C220BB; Fri, 15 Mar 2019 14:15:01 +0000 (UTC) Received: from vrout30.yaziba.net (vrout30.yaziba.net [185.56.204.33]) by lists.denx.de (Postfix) with ESMTPS id 85C87C2209F for ; Fri, 15 Mar 2019 14:15:01 +0000 (UTC) Received: from mtaout20.int.yaziba.net (mtaout20.int.yaziba.net [10.4.20.37]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by vrout30.yaziba.net (mx10.yaziba.net) with ESMTPS id 7ED9352006; Fri, 15 Mar 2019 15:15:00 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mtaout20.int.yaziba.net (Postfix) with ESMTP id 10D921601A7; Fri, 15 Mar 2019 15:15:00 +0100 (CET) Received: from mtaout20.int.yaziba.net ([127.0.0.1]) by localhost (mtaout20.int.yaziba.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id IEW1CwuECDu3; Fri, 15 Mar 2019 15:14:59 +0100 (CET) Received: from sahnlpt0333.softathome.com (unknown [149.6.166.170]) by mtaout20.int.yaziba.net (Postfix) with ESMTPSA id C22551601A4; Fri, 15 Mar 2019 15:14:59 +0100 (CET) From: Philippe Reynes To: albert.u.boot@aribaud.net, daniel.schwierzeck@gmail.com, noltari@gmail.com, miquel.raynal@bootlin.com, maxime.ripard@bootlin.com, stefan.agner@toradex.com, aford173@gmail.com, lukma@denx.de, t.karthik.reddy@xilinx.com, woods.technical@gmail.com, joerg.krause@embedded.rocks, sr@denx.de, boris.brezillon@bootlin.com, jagan@openedev.com, robert.jarzmik@free.fr, mylene.josserand@bootlin.com, sjg@chromium.org, bmeng.cn@gmail.com, zajec5@gmail.com, computersforpeace@gmail.com, marc_gonzalez@sigmadesigns.com Date: Fri, 15 Mar 2019 15:14:31 +0100 Message-Id: <1552659287-11246-3-git-send-email-philippe.reynes@softathome.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1552659287-11246-1-git-send-email-philippe.reynes@softathome.com> References: <1552659287-11246-1-git-send-email-philippe.reynes@softathome.com> X-CLAMAV-SCAN: ok X-VRSPAM-SCORE: -100 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrgedutddrheehgdeifecutefuodetggdotefrucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfsedttdertdertddtnecuhfhrohhmpefrhhhilhhiphhpvgcutfgvhihnvghsuceophhhihhlihhpphgvrdhrvgihnhgvshesshhofhhtrghthhhomhgvrdgtohhmqeenucfkphepudegledriedrudeiiedrudejtdenucfrrghrrghmpehmohguvgepshhmthhpohhuth X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht X-Mailman-Approved-At: Fri, 15 Mar 2019 14:21:59 +0000 Cc: u-boot@lists.denx.de, Boris Brezillon Subject: [U-Boot] [PATCH 02/18] mtd: nand: import nand_hw_control_init() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Marc Gonzalez Linux commit d45bc58dd3b ("mtd: nand: import nand_hw_control_init()") The code to initialize a struct nand_hw_control is duplicated across several drivers. Factorize it using an inline function. Signed-off-by: Marc Gonzalez Signed-off-by: Boris Brezillon [Philippe Reynes: adapt code to u-boot and only keep new function] Signed-off-by: Philippe Reynes --- include/linux/mtd/rawnand.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h index e2bd598..96b5847 100644 --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h @@ -499,6 +499,13 @@ struct nand_hw_control { struct nand_chip *active; }; +static inline void nand_hw_control_init(struct nand_hw_control *nfc) +{ + nfc->active = NULL; + spin_lock_init(&nfc->lock); + init_waitqueue_head(&nfc->wq); +} + /** * struct nand_ecc_step_info - ECC step information of ECC engine * @stepsize: data bytes per ECC step