From patchwork Fri Oct 16 18:40:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 7420101 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E07AD9F302 for ; Fri, 16 Oct 2015 18:44:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C98D020891 for ; Fri, 16 Oct 2015 18:44:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8C1B02088A for ; Fri, 16 Oct 2015 18:44:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932693AbbJPSlF (ORCPT ); Fri, 16 Oct 2015 14:41:05 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:34519 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932551AbbJPSk7 (ORCPT ); Fri, 16 Oct 2015 14:40:59 -0400 Received: by pacez2 with SMTP id ez2so11670440pac.1 for ; Fri, 16 Oct 2015 11:40:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=VExfJUsCAaqPNXfeQcqwaGIzQC3mSzsIRRdRUsswurY=; b=VxZweblrRZYbSXX98ffnqtsBLwaq5iR654wCsnSOQA/eQJ9hUgSfOefylbpZ8hvt0H LTZXkwK7ps/Af/Cf947d2MmgHlE0UnH+yhINl7kVufKwh5g0lPcmuEgX+X5E/MvQCsrg /xpk+H/dDpiPTnre8ge6tnKcaLFo8D7EyWqVPBS5ux8cUYHp1qUU6mFvEICJY7GaHmsj Xid4G676ORUYuK0mkVyZ3HmGuHqP7bAgfYY/wZIJEZiWmpNIGdmmX4KzlXn8hDvIXXQF tiulXoEkie3Mlqme1xbx+NgNT3UbyXngYIqmcId/HId6gSUAG5TB3RfswRe6TnCF3WS9 rmGg== X-Gm-Message-State: ALoCoQksT9V14YwjzECh9HrEqFOPX+3Qpw8vxQS4y/x9k1LQffe+FITrOe+flvG0MYT0kDFZmR+M X-Received: by 10.68.163.194 with SMTP id yk2mr2529877pbb.102.1445020859300; Fri, 16 Oct 2015 11:40:59 -0700 (PDT) Received: from localhost.localdomain (c-76-115-103-22.hsd1.or.comcast.net. [76.115.103.22]) by smtp.gmail.com with ESMTPSA id ir4sm22486242pbb.93.2015.10.16.11.40.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Oct 2015 11:40:58 -0700 (PDT) From: John Stultz To: linux-kernel@vger.kernel.org Cc: Colin Cross , Ulf Hansson , Adrian Hunter , Ben Hutchings , Chuanxiao Dong , Shawn Lin , Android Kernel Team , linux-mmc@vger.kernel.org, John Stultz Subject: [RFC][PATCH] mmc_block: Allow more than 8 partitions per card Date: Fri, 16 Oct 2015 11:40:46 -0700 Message-Id: <1445020846-529-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Colin Cross It is quite common for Android devices to utilize more then 8 partitions on internal eMMC storage. This patch, which has been carried for quite awhile in the AOSP common tree is necessary in order to support such configurations, so I wanted to submit it for consideration upstream. This patch sets the GENHD_FL_EXT_DEVT flag, which will allocate minor number in major 259 for partitions past disk->minors. It also removes the use of disk_devt to determine devidx from md->disk. md->disk->first_minor is always initialized from devidx and can always be used to recover it. Thoughts or feedback would be greatly appreciated. Cc: Ulf Hansson Cc: Adrian Hunter Cc: Ben Hutchings Cc: Chuanxiao Dong Cc: Shawn Lin Cc: Android Kernel Team Cc: linux-mmc@vger.kernel.org Signed-off-by: Colin Cross [jstultz: Added context to commit message] Signed-off-by: John Stultz --- drivers/mmc/card/block.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index c742cfd..564436e 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -172,11 +172,7 @@ static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk) static inline int mmc_get_devidx(struct gendisk *disk) { - int devmaj = MAJOR(disk_devt(disk)); - int devidx = MINOR(disk_devt(disk)) / perdev_minors; - - if (!devmaj) - devidx = disk->first_minor / perdev_minors; + int devidx = disk->first_minor / perdev_minors; return devidx; } @@ -2162,6 +2158,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, md->disk->queue = md->queue.queue; md->disk->driverfs_dev = parent; set_disk_ro(md->disk, md->read_only || default_ro); + md->disk->flags = GENHD_FL_EXT_DEVT; if (area_type & (MMC_BLK_DATA_AREA_RPMB | MMC_BLK_DATA_AREA_BOOT)) md->disk->flags |= GENHD_FL_NO_PART_SCAN;