From patchwork Wed Nov 5 14:40:18 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atsushi Nemoto X-Patchwork-Id: 7349 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 E190ADDDFA for ; Thu, 6 Nov 2008 01:42:20 +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 1KxjYX-0004vz-Kc; Wed, 05 Nov 2008 14:40:25 +0000 Received: from mba.ocn.ne.jp ([122.1.235.107] helo=smtp.mba.ocn.ne.jp) by bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux)) id 1KxjYJ-0004vO-5z for linux-mtd@lists.infradead.org; Wed, 05 Nov 2008 14:40:23 +0000 Received: from localhost (p5158-ipad306funabasi.chiba.ocn.ne.jp [123.217.175.158]) by smtp.mba.ocn.ne.jp (Postfix) with ESMTP id 01C1EAC3B; Wed, 5 Nov 2008 23:40:10 +0900 (JST) Date: Wed, 05 Nov 2008 23:40:18 +0900 (JST) Message-Id: <20081105.234018.26100329.anemo@mba.ocn.ne.jp> To: linux-mtd@lists.infradead.org Subject: [PATCH] physmap: Make map_info customizable From: Atsushi Nemoto X-Fingerprint: 6ACA 1623 39BD 9A94 9B1A B746 CA77 FE94 2874 D52F X-Pgp-Public-Key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F X-Mailer: Mew version 5.2 on Emacs 21.4 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 X-Spam-Score: 0.0 (/) Cc: David Woodhouse , 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: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Add a hook to physmap_flash_data for map_info initialization. This makes platform code can customize map operations. Signed-off-by: Atsushi Nemoto --- Background: I wrote this patch to support RBTX4939 board, which requires custom map->{read,write,copy_from} function. I think extending the physmap driver is better than adding a new map driver. drivers/mtd/maps/physmap.c | 5 ++++- include/linux/mtd/physmap.h | 1 + 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index dfbf3f2..7ca048d 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c @@ -128,7 +128,10 @@ static int physmap_flash_probe(struct platform_device *dev) goto err_out; } - simple_map_init(&info->map[i]); + if (physmap_data->map_init) + (*physmap_data->map_init)(&info->map[i]); + else + simple_map_init(&info->map[i]); probe_type = rom_probe_types; for (; info->mtd[i] == NULL && *probe_type != NULL; probe_type++) diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h index c8e63a5..bf51a63 100644 --- a/include/linux/mtd/physmap.h +++ b/include/linux/mtd/physmap.h @@ -25,6 +25,7 @@ struct physmap_flash_data { void (*set_vpp)(struct map_info *, int); unsigned int nr_parts; struct mtd_partition *parts; + void (*map_init)(struct map_info *map); }; /*