From patchwork Fri Nov 14 12:22:49 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 8762 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 64198DDDF9 for ; Fri, 14 Nov 2008 23:32:56 +1100 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux)) id 1L0xpv-0001Hi-K4; Fri, 14 Nov 2008 12:31:43 +0000 Received: from smtp.gentoo.org ([140.211.166.183]) by bombadil.infradead.org with esmtps (Exim 4.68 #1 (Red Hat Linux)) id 1L0xhM-00009D-75 for linux-mtd@lists.infradead.org; Fri, 14 Nov 2008 12:22:52 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 8D486643EB; Fri, 14 Nov 2008 12:22:50 +0000 (UTC) From: Mike Frysinger To: linux-mtd@lists.infradead.org, David Woodhouse Subject: [PATCH v2] mtd/bfin-async-flash: use parse_mtd() Date: Fri, 14 Nov 2008 07:22:49 -0500 Message-Id: <1226665369-20248-2-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 1.6.0.3 In-Reply-To: <1226665351-20226-1-git-send-email-vapier@gentoo.org> References: <1226665351-20226-1-git-send-email-vapier@gentoo.org> X-Bad-Reply: References and In-Reply-To but no 'Re:' in Subject. X-Spam-Score: 0.0 (/) X-Mailman-Approved-At: Fri, 14 Nov 2008 07:31:42 -0500 Cc: Atsushi Nemoto , linux-kernel@vger.kernel.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.9 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 Call parse_mtd() to handle partition/device registration rather than doing it all ourself. Signed-off-by: Mike Frysinger --- v2: - call unparse_mtd() drivers/mtd/maps/bfin-async-flash.c | 32 ++++---------------------------- 1 files changed, 4 insertions(+), 28 deletions(-) diff --git a/drivers/mtd/maps/bfin-async-flash.c b/drivers/mtd/maps/bfin-async-flash.c index 6fec86a..e432f94 100644 --- a/drivers/mtd/maps/bfin-async-flash.c +++ b/drivers/mtd/maps/bfin-async-flash.c @@ -120,13 +120,8 @@ static void bfin_copy_to(struct map_info *map, unsigned long to, const void *fro switch_back(state); } -#ifdef CONFIG_MTD_PARTITIONS -static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; -#endif - static int __devinit bfin_flash_probe(struct platform_device *pdev) { - int ret; struct physmap_flash_data *pdata = pdev->dev.platform_data; struct resource *memory = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct resource *flash_ambctl = platform_get_resource(pdev, IORESOURCE_MEM, 1); @@ -150,6 +145,8 @@ static int __devinit bfin_flash_probe(struct platform_device *pdev) state->flash_ambctl0 = flash_ambctl->start; state->flash_ambctl1 = flash_ambctl->end; + platform_set_drvdata(pdev, state); + if (gpio_request(state->enet_flash_pin, DRIVER_NAME)) { pr_devinit(KERN_ERR DRIVER_NAME ": Failed to request gpio %d\n", state->enet_flash_pin); return -EBUSY; @@ -161,35 +158,14 @@ static int __devinit bfin_flash_probe(struct platform_device *pdev) if (!state->mtd) return -ENXIO; -#ifdef CONFIG_MTD_PARTITIONS - ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0); - if (ret > 0) { - pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n"); - add_mtd_partitions(state->mtd, pdata->parts, ret); - - } else if (pdata->nr_parts) { - pr_devinit(KERN_NOTICE DRIVER_NAME ": Using board partition definition\n"); - add_mtd_partitions(state->mtd, pdata->parts, pdata->nr_parts); - - } else -#endif - { - pr_devinit(KERN_NOTICE DRIVER_NAME ": no partition info available, registering whole flash at once\n"); - add_mtd_device(state->mtd); - } - - platform_set_drvdata(pdev, state); - - return 0; + return parse_mtd(state->mtd, NULL, pdata->parts, pdata->nr_parts, false); } static int __devexit bfin_flash_remove(struct platform_device *pdev) { struct async_state *state = platform_get_drvdata(pdev); gpio_free(state->enet_flash_pin); -#ifdef CONFIG_MTD_PARTITIONS - del_mtd_partitions(state->mtd); -#endif + unparse_mtd(state->mtd); map_destroy(state->mtd); kfree(state); return 0;