From patchwork Tue Jun 7 13:36:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 99172 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A783CB6FBE for ; Tue, 7 Jun 2011 23:38:52 +1000 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QTwUV-0001Wt-4T; Tue, 07 Jun 2011 13:38:43 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QTwUU-0001t1-HY; Tue, 07 Jun 2011 13:38:42 +0000 Received: from mail-ww0-f41.google.com ([74.125.82.41]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QTwSp-0001Qm-JX for linux-mtd@lists.infradead.org; Tue, 07 Jun 2011 13:37:01 +0000 Received: by mail-ww0-f41.google.com with SMTP id 18so2387416wwi.0 for ; Tue, 07 Jun 2011 06:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=7weZlP7LZMdo7P4kXZTPZE1YbeHbX/3y+rTIB8JmCdk=; b=IuqGOxUVqURlIC0vOG2HFhcG3jmj4uJyjZPxLwfcjBrW1tGJm5B9p5pEL0Oen2wdiP FzfrXFdDPO+A6yvpaVub5B6DodYaDwyEtZn15c3S+x5gQLXHRT6emDsi0cDDKFOx99hO DGTYvJDAkYjEkSM44WfYmAHrT8w/kqCWZzF/Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=OVySzZCMJcyOULTEPhFsPCpSQoVNJpRJ9gYnTdKLjoI+8kMQFennJnoXP1CgD9whHp tu9sQLyw5T8JGEhCnU+wq6c5KsO/1BeTEPpXsVJgnxhVT0Ya4ogqPjnepOtZhj/XRrjZ wtItNrJP9HHvR+dAfBRgSgNh4Ded6j96bZB4o= Received: by 10.227.100.219 with SMTP id z27mr6343715wbn.45.1307453819223; Tue, 07 Jun 2011 06:36:59 -0700 (PDT) Received: from doriath.ww600.siemens.net ([91.213.169.4]) by mx.google.com with ESMTPS id fl19sm1689263wbb.66.2011.06.07.06.36.57 (version=SSLv3 cipher=OTHER); Tue, 07 Jun 2011 06:36:58 -0700 (PDT) From: Dmitry Eremin-Solenikov To: linux-mtd@lists.infradead.org Subject: [PATCH 09/44] mtd: impa7.c: use mtd_device_parse_register Date: Tue, 7 Jun 2011 17:36:08 +0400 Message-Id: <1307453803-31950-10-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1307453803-31950-1-git-send-email-dbaryshkov@gmail.com> References: <1307453803-31950-1-git-send-email-dbaryshkov@gmail.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110607_093659_922238_B880430C X-CRM114-Status: GOOD ( 12.24 ) X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.41 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is freemail (dbaryshkov[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 RFC_ABUSE_POST Both abuse and postmaster missing on sender domain 0.0 T_TO_NO_BRKTS_FREEMAIL T_TO_NO_BRKTS_FREEMAIL Cc: David Woodhouse , dedekind1@gmail.com X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Replace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc. Signed-off-by: Dmitry Eremin-Solenikov --- drivers/mtd/maps/impa7.c | 25 +++---------------------- 1 files changed, 3 insertions(+), 22 deletions(-) diff --git a/drivers/mtd/maps/impa7.c b/drivers/mtd/maps/impa7.c index 2d45a48..7b8b5d8 100644 --- a/drivers/mtd/maps/impa7.c +++ b/drivers/mtd/maps/impa7.c @@ -58,15 +58,10 @@ static struct mtd_partition static_partitions[] = }, }; -static int mtd_parts_nb[NUM_FLASHBANKS]; -static struct mtd_partition *mtd_parts[NUM_FLASHBANKS]; - - static int __init init_impa7(void) { static const char *rom_probe_types[] = PROBETYPES; const char **type; - const char *part_type = 0; int i; static struct { u_long addr; u_long size; } pt[NUM_FLASHBANKS] = { { WINDOW_ADDR0, WINDOW_SIZE0 }, @@ -96,23 +91,9 @@ static int __init init_impa7(void) if (impa7_mtd[i]) { impa7_mtd[i]->owner = THIS_MODULE; devicesfound++; - mtd_parts_nb[i] = parse_mtd_partitions(impa7_mtd[i], - NULL, - &mtd_parts[i], - 0); - if (mtd_parts_nb[i] > 0) { - part_type = "command line"; - } else { - mtd_parts[i] = static_partitions; - mtd_parts_nb[i] = ARRAY_SIZE(static_partitions); - part_type = "static"; - } - - printk(KERN_NOTICE MSG_PREFIX - "using %s partition definition\n", - part_type); - mtd_device_register(impa7_mtd[i], - mtd_parts[i], mtd_parts_nb[i]); + mtd_device_parse_register(impa7_mtd[i], NULL, 0, + static_partitions, + ARRAY_SIZE(static_partitions)); } else iounmap((void *)impa7_map[i].virt);