From patchwork Mon Dec 1 22:23:37 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 11673 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 132AADDDE7 for ; Tue, 2 Dec 2008 09:26:13 +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 1L7HBa-0007yy-N9; Mon, 01 Dec 2008 22:24:10 +0000 Received: from smtp1.linux-foundation.org ([140.211.169.13]) by bombadil.infradead.org with esmtps (Exim 4.68 #1 (Red Hat Linux)) id 1L7HBY-0007yp-W7; Mon, 01 Dec 2008 22:24:09 +0000 Received: from imap1.linux-foundation.org (imap1.linux-foundation.org [140.211.169.55]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id mB1MNbk4019893 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 1 Dec 2008 14:23:38 -0800 Received: from localhost.localdomain (localhost [127.0.0.1]) by imap1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with ESMTP id mB1MNbjl014522; Mon, 1 Dec 2008 14:23:37 -0800 Message-Id: <200812012223.mB1MNbjl014522@imap1.linux-foundation.org> Subject: [patch 1/6] physmap: make map_info customizable To: dwmw2@infradead.org From: akpm@linux-foundation.org Date: Mon, 01 Dec 2008 14:23:37 -0800 X-Spam-Status: No, hits=-3.399 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 X-Spam-Score: 0.0 (/) Cc: akpm@linux-foundation.org, linux-mtd@lists.infradead.org, anemo@mba.ocn.ne.jp 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 From: Atsushi Nemoto Add a hook to physmap_flash_data for map_info initialization. This makes platform code can customize map operations. 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. Signed-off-by: Atsushi Nemoto Signed-off-by: Andrew Morton --- drivers/mtd/maps/physmap.c | 5 ++++- include/linux/mtd/physmap.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff -puN drivers/mtd/maps/physmap.c~physmap-make-map_info-customizable drivers/mtd/maps/physmap.c --- a/drivers/mtd/maps/physmap.c~physmap-make-map_info-customizable +++ a/drivers/mtd/maps/physmap.c @@ -128,7 +128,10 @@ static int physmap_flash_probe(struct pl 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 -puN include/linux/mtd/physmap.h~physmap-make-map_info-customizable include/linux/mtd/physmap.h --- a/include/linux/mtd/physmap.h~physmap-make-map_info-customizable +++ a/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); }; /*