From patchwork Tue Jun 7 13:36:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 99182 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 8FFC9B6FC1 for ; Tue, 7 Jun 2011 23:40:28 +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 1QTwVw-0003gP-N9; Tue, 07 Jun 2011 13:40:14 +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 1QTwVw-0002BF-7Z; Tue, 07 Jun 2011 13:40:12 +0000 Received: from mail-ww0-f49.google.com ([74.125.82.49]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QTwT7-0001Tv-AV for linux-mtd@lists.infradead.org; Tue, 07 Jun 2011 13:37:18 +0000 Received: by mail-ww0-f49.google.com with SMTP id 39so3852637wwb.18 for ; Tue, 07 Jun 2011 06:37:17 -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=taruaIvr40bD251gmhlYWjbQ8V1Fz9vXVdRaNnJSrag=; b=cwOyG6fr3ZSErNpPbp8y8z5TXZW1FqiJDjf9/S1RjxngiiAJ3ZfZssSVh7DNLQwi7R oVgPlU1aR+RwDC7Zv4Ylg/zHNQwKvC/eX8bzYCuHY8WG4dHqkslQYyeE7ZRPw0v2GXJE r0nhn2Q+INfZAoWjqHjtD1Z5xrkIf6jhdXo00= 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=Ic+ETmzoX5qUGi0QD0OP1LhiutlqASDEOXmVL1h2yK0nML9EA1dRR4Hc9Bt/38GuzR mZvX5PTfXDliJuFW2NdaxazstC7sCtXU9m1qapM9Z0hsgnsUzXadMHpPPgan8ojb0Noa xPZpQMllSyVI4hMhl9li9eSwcPCMocTj0UgMw= Received: by 10.227.11.148 with SMTP id t20mr6205739wbt.98.1307453836732; Tue, 07 Jun 2011 06:37:16 -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.37.14 (version=SSLv3 cipher=OTHER); Tue, 07 Jun 2011 06:37:15 -0700 (PDT) From: Dmitry Eremin-Solenikov To: linux-mtd@lists.infradead.org Subject: [PATCH 19/44] mtd: sa1100-flash.c: use mtd_device_parse_register Date: Tue, 7 Jun 2011 17:36:18 +0400 Message-Id: <1307453803-31950-20-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_093717_597169_0FBAF6DB X-CRM114-Status: GOOD ( 14.11 ) 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.49 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/sa1100-flash.c | 30 +++--------------------------- 1 files changed, 3 insertions(+), 27 deletions(-) diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index a9b5e0e..fa9c0a9 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c @@ -131,10 +131,8 @@ struct sa_subdev_info { }; struct sa_info { - struct mtd_partition *parts; struct mtd_info *mtd; int num_subdev; - unsigned int nr_parts; struct sa_subdev_info subdev[0]; }; @@ -231,8 +229,6 @@ static void sa1100_destroy(struct sa_info *info, struct flash_platform_data *pla mtd_concat_destroy(info->mtd); } - kfree(info->parts); - for (i = info->num_subdev - 1; i >= 0; i--) sa1100_destroy_subdev(&info->subdev[i]); kfree(info); @@ -341,10 +337,8 @@ static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; static int __devinit sa1100_mtd_probe(struct platform_device *pdev) { struct flash_platform_data *plat = pdev->dev.platform_data; - struct mtd_partition *parts; - const char *part_type = NULL; struct sa_info *info; - int err, nr_parts = 0; + int err; if (!plat) return -ENODEV; @@ -358,26 +352,8 @@ static int __devinit sa1100_mtd_probe(struct platform_device *pdev) /* * Partition selection stuff. */ - nr_parts = parse_mtd_partitions(info->mtd, part_probes, &parts, 0); - if (nr_parts > 0) { - info->parts = parts; - part_type = "dynamic"; - } else { - parts = plat->parts; - nr_parts = plat->nr_parts; - part_type = "static"; - } - - if (nr_parts == 0) - printk(KERN_NOTICE "SA1100 flash: no partition info " - "available, registering whole flash\n"); - else - printk(KERN_NOTICE "SA1100 flash: using %s partition " - "definition\n", part_type); - - mtd_device_register(info->mtd, parts, nr_parts); - - info->nr_parts = nr_parts; + mtd_device_parse_register(info->mtd, part_probes, 0, + plat->parts, plat->nr_parts); platform_set_drvdata(pdev, info); err = 0;