From patchwork Thu Jun 2 14:51:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 98413 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 DDD75B6FA1 for ; Fri, 3 Jun 2011 00:55:45 +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 1QS9IS-0000jq-DF; Thu, 02 Jun 2011 14:54:53 +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 1QS9IR-00083F-CV; Thu, 02 Jun 2011 14:54:51 +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 1QS9Fk-00074e-SV for linux-mtd@lists.infradead.org; Thu, 02 Jun 2011 14:52:06 +0000 Received: by mail-ww0-f49.google.com with SMTP id 39so758005wwb.18 for ; Thu, 02 Jun 2011 07:52:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:message-id:x-mailer :in-reply-to:references; bh=Ipcw2sqKFRSolQMaIvk5XHC20JKWTp5Mf2KhYW091lE=; b=lk1CJl+Vkjs1Ivs4dmFEmltAS5k27JH6ssT8xHMAOeu1P7bZC6w2PQO2Hwa94gKo5o 95q3Y+ClCpMiDtosOhqsYGch/3rH8zJLGVpmjcD15Z55nKSG+mDAUlXDO8/DCnA5mJPn lypHKeXrXIFOg7e+AWtnf84ihpbAtcBavjSA4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; b=mT5FpUiWTW29F/yRzwfgj9HU9zgcTBcgt/6HH2m3A5dl1LgzCPJlTyiEnnxTLH1g9J BEYT9fclQYqFLMW/Ca923K5qUEsLD0khikTHiLoCKXOH0Z9Oc+U0PruV93+XACFLETtI 8j4U/0D4ODRVkD8f2nT01PhnsgWi3BKzswD0Y= Received: by 10.216.231.165 with SMTP id l37mr788522weq.78.1307026324511; Thu, 02 Jun 2011 07:52:04 -0700 (PDT) Received: from doriath.ww600.siemens.net ([91.213.169.4]) by mx.google.com with ESMTPS id k70sm368125weq.6.2011.06.02.07.52.03 (version=SSLv3 cipher=OTHER); Thu, 02 Jun 2011 07:52:03 -0700 (PDT) From: Dmitry Eremin-Solenikov To: linux-mtd@lists.infradead.org Subject: [PATCH 055/104] mtd: lart.c: use mtd_device_parse_register Date: Thu, 2 Jun 2011 18:51:33 +0400 Message-Id: <1307026293-8535-21-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1307026293-8535-1-git-send-email-dbaryshkov@gmail.com> References: <1307026293-8535-1-git-send-email-dbaryshkov@gmail.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110602_105205_167767_E6C5B771 X-CRM114-Status: GOOD ( 11.80 ) 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 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/devices/lart.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/mtd/devices/lart.c b/drivers/mtd/devices/lart.c index 772a0ff..48b513f 100644 --- a/drivers/mtd/devices/lart.c +++ b/drivers/mtd/devices/lart.c @@ -619,6 +619,10 @@ static struct mtd_partition lart_partitions[] = { .size = INITRD_LEN, /* MTDPART_SIZ_FULL */ } }; +#define NUM_PARTITIONS ARRAY_SIZE(lart_partitions) +#else +#define lart_partitions NULL +#define NUM_PARTITIONS 0 #endif static int __init lart_flash_init (void) @@ -683,23 +687,15 @@ static int __init lart_flash_init (void) #endif #endif -#ifndef HAVE_PARTITIONS - result = mtd_device_register(&mtd, NULL, 0); -#else result = mtd_device_register(&mtd, lart_partitions, ARRAY_SIZE(lart_partitions)); -#endif return (result); } static void __exit lart_flash_exit (void) { -#ifndef HAVE_PARTITIONS mtd_device_unregister(&mtd); -#else - mtd_device_unregister(&mtd); -#endif } module_init (lart_flash_init);