From patchwork Tue Oct 12 10:18:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hu Mingkai-B21284 X-Patchwork-Id: 247401 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9CAk9jR013458 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 12 Oct 2010 10:46:30 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1P5cMu-0002Ku-Mq; Tue, 12 Oct 2010 10:46:04 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1P5cMt-0002Kh-CO for spi-devel-general@lists.sourceforge.net; Tue, 12 Oct 2010 10:46:03 +0000 X-ACL-Warn: Received: from am1ehsobe006.messaging.microsoft.com ([213.199.154.209] helo=AM1EHSOBE006.bigfish.com) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES128-SHA:128) (Exim 4.69) id 1P5cMs-0002Bd-9G for spi-devel-general@lists.sourceforge.net; Tue, 12 Oct 2010 10:46:03 +0000 Received: from mail19-am1-R.bigfish.com (10.3.201.244) by AM1EHSOBE006.bigfish.com (10.3.204.26) with Microsoft SMTP Server id 14.1.225.8; Tue, 12 Oct 2010 10:45:55 +0000 Received: from mail19-am1 (localhost.localdomain [127.0.0.1]) by mail19-am1-R.bigfish.com (Postfix) with ESMTP id F33D78D829C for ; Tue, 12 Oct 2010 10:45:55 +0000 (UTC) X-SpamScore: -3 X-BigFish: VS-3(zzbb2cKzz1202hzz8275bhz2dh2a8h61h) X-Spam-TCS-SCL: 0:0 Received: from mail19-am1 (localhost.localdomain [127.0.0.1]) by mail19-am1 (MessageSwitch) id 1286880355827319_10037; Tue, 12 Oct 2010 10:45:55 +0000 (UTC) Received: from am1ehsmhs010.bigfish.com (unknown [10.3.201.251]) by mail19-am1.bigfish.com (Postfix) with ESMTP id C5CAA19E804D for ; Tue, 12 Oct 2010 10:45:55 +0000 (UTC) Received: from de01egw02.freescale.net (192.88.165.103) by am1ehsmhs010.bigfish.com (10.3.207.110) with Microsoft SMTP Server (TLS) id 14.0.482.44; Tue, 12 Oct 2010 10:45:54 +0000 Received: from az33smr02.freescale.net (az33smr02.freescale.net [10.64.34.200]) by de01egw02.freescale.net (8.14.3/8.14.3) with ESMTP id o9CAjrnG003028 for ; Tue, 12 Oct 2010 03:45:53 -0700 (MST) Received: from zch01exm21.fsl.freescale.net (zch01exm21.ap.freescale.net [10.192.129.205]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id o9CAji8w013345 for ; Tue, 12 Oct 2010 05:45:52 -0500 (CDT) Received: from localhost ([10.193.20.106]) by zch01exm21.fsl.freescale.net with Microsoft SMTPSVC(6.0.3790.4675); Tue, 12 Oct 2010 18:45:54 +0800 From: Mingkai Hu To: , , Subject: [PATCH v4 5/5] mtd: m25p80: add support to parse the partitions by OF node Date: Tue, 12 Oct 2010 18:18:34 +0800 Message-ID: <1286878714-13090-6-git-send-email-Mingkai.hu@freescale.com> X-Mailer: git-send-email 1.6.4 In-Reply-To: <1286878714-13090-5-git-send-email-Mingkai.hu@freescale.com> References: <1286878714-13090-1-git-send-email-Mingkai.hu@freescale.com> <1286878714-13090-2-git-send-email-Mingkai.hu@freescale.com> <1286878714-13090-3-git-send-email-Mingkai.hu@freescale.com> <1286878714-13090-4-git-send-email-Mingkai.hu@freescale.com> <1286878714-13090-5-git-send-email-Mingkai.hu@freescale.com> X-OriginalArrivalTime: 12 Oct 2010 10:45:54.0288 (UTC) FILETIME=[A51A0F00:01CB69FA] MIME-Version: 1.0 X-Reverse-DNS: de01egw02.freescale.net X-Spam-Score: 0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. X-Headers-End: 1P5cMs-0002Bd-9G Cc: david-b@pacbell.net, kumar.gala@freescale.com, tie-fei.zang@freescale.com, Mingkai Hu X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 12 Oct 2010 10:46:30 +0000 (UTC) diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 6f512b5..9d20738 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -924,6 +924,11 @@ static int __devinit m25p_probe(struct spi_device *spi) nr_parts = data->nr_parts; } + if (nr_parts <= 0 && spi->dev.of_node) { + nr_parts = of_mtd_parse_partitions(&spi->dev, + spi->dev.of_node, &parts); + } + if (nr_parts > 0) { for (i = 0; i < nr_parts; i++) { DEBUG(MTD_DEBUG_LEVEL2, "partitions[%d] = "