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: 55140 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by patches.linaro.org (Postfix) with ESMTPS id 5D49F22EAC for ; Fri, 16 Oct 2015 18:41:02 +0000 (UTC) Received: by lbbyh1 with SMTP id yh1sf21503883lbb.0 for ; Fri, 16 Oct 2015 11:41:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=VExfJUsCAaqPNXfeQcqwaGIzQC3mSzsIRRdRUsswurY=; b=PEML2A1CmXB6/x0/1b3xm4p9clBg33ziYdY+hpwhETjxhdG3ZzlN5EmZSvHpO92lHr /3umSTGo13h7LB9vZYTmjY6ci+9iKoqSkX3dIAHw1hYDAB5XknfhsKvZ7BxgF2Gl2sOl r9TA2pNIZTlDZI2cK9XDZQ8D6/4txUW2kA6/GOkPFpI7xi83pFnR9KwnsnVkK0Yur/kx qr5QoC4rn97KNUjEpw8l+EehtQK26ZcJscdOYKcN4Oifd/RM1wXdndMMIrTqp1ScdEIC O4kjiFGeXrhFrlsz26pNicpSYI3vIM36920qQTTMPblTBalGyIsnQ13YV6U1gCSlNS7U 1N/g== X-Gm-Message-State: ALoCoQnk+T/rPGh377uhNrlf4lfKy2MwQWKa0YlgGFbHMZLAERnuBsH406psydBjYAQgFwLqkA8l X-Received: by 10.112.136.99 with SMTP id pz3mr4001792lbb.11.1445020861224; Fri, 16 Oct 2015 11:41:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.18.233 with SMTP id 102ls366868lfs.1.gmail; Fri, 16 Oct 2015 11:41:01 -0700 (PDT) X-Received: by 10.112.130.39 with SMTP id ob7mr9202212lbb.66.1445020861090; Fri, 16 Oct 2015 11:41:01 -0700 (PDT) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id p140si13753274lfd.22.2015.10.16.11.41.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Oct 2015 11:41:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lffz202 with SMTP id z202so1161774lff.3 for ; Fri, 16 Oct 2015 11:41:00 -0700 (PDT) X-Received: by 10.25.82.10 with SMTP id g10mr6102942lfb.56.1445020860863; Fri, 16 Oct 2015 11:41:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.59.35 with SMTP id w3csp85840lbq; Fri, 16 Oct 2015 11:40:59 -0700 (PDT) X-Received: by 10.68.184.195 with SMTP id ew3mr18213692pbc.28.1445020859710; Fri, 16 Oct 2015 11:40:59 -0700 (PDT) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com. [209.85.220.46]) by mx.google.com with ESMTPS id b10si262803pas.88.2015.10.16.11.40.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Oct 2015 11:40:59 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.46 as permitted sender) client-ip=209.85.220.46; Received: by pabrc13 with SMTP id rc13so127591562pab.0 for ; Fri, 16 Oct 2015 11:40:59 -0700 (PDT) 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 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;