From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45609C47096 for ; Thu, 3 Jun 2021 15:38:26 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AAAB06100B for ; Thu, 3 Jun 2021 15:38:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AAAB06100B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Fwqmc5ktlz303q for ; Fri, 4 Jun 2021 01:38:24 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=XGhrfqnz; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linaro.org (client-ip=2607:f8b0:4864:20::930; helo=mail-ua1-x930.google.com; envelope-from=ulf.hansson@linaro.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=XGhrfqnz; dkim-atps=neutral Received: from mail-ua1-x930.google.com (mail-ua1-x930.google.com [IPv6:2607:f8b0:4864:20::930]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Fwqlb6Lhzz2yxq for ; Fri, 4 Jun 2021 01:37:29 +1000 (AEST) Received: by mail-ua1-x930.google.com with SMTP id g34so3526447uah.8 for ; Thu, 03 Jun 2021 08:37:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7DKVf+GiS9951bpd4cfEBh88PiRutTQ//wVEud26id8=; b=XGhrfqnzBbfnTVSNkFDv5GHmpnKX09udhfIYlIGvsHf5udWupM3hEeaCuAp1/iGcK2 itxazCeDLeGnN0Ew9V7mjQKrXGASjKXLT43xef2dS4qB5N1wZq329ew5d1FZXKKcqiVw 6FD/vr0CrXQkvA5Vx5CUZuiBjtgVFz1ZbiUU7kgR3MEWuPhMcO948V0XjU30zv2QSu9a tohz+jrjUWOtrbk55SyLep3Y8Ie2TFo0EIpc+U1g5ZdabSEhCf2ga/7pzz9IJem82LbC xz7dKg0/t3XaDdcBysnSaVg/DwjADlBkyj4crHUSmvNFlYRf/JXspkWoLbMUskTXooPD 5/eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7DKVf+GiS9951bpd4cfEBh88PiRutTQ//wVEud26id8=; b=Z0ubtxLEkslZge1wkdDTi2WuDvOcsS3i4YZs6F5pL4t4r31/2IDG6pV1GyPk7qHOlO mkijKvhZg56tvf8XjNanfRdvGY9WHsYuRJSKicKnMGGJK0PtTCUprGXgRVLwNNpvLT3J JgDKTE1nsbzr++EKAO0WErMD9qkpVuubvCjaEoAoXgvQog73P/mMyseVvpo0PUbqGroK Uw/tcT9LvW4eoF9vLB9pPKzRALiB7QIowi+wCanCpGWnS28g9WaECgyAEkFOK14dogkX Azb9uI2HeMM3jYHdlJ2mJM2ICKPjgOuMAgLZSOl7atvrcvPk/odN4qVkpDMe3x2OYiPP dzGw== X-Gm-Message-State: AOAM531ceVTMA4Oe6YZnLV32w8fhiOguE57BdqLoB6TvYXieM3fjIzH5 DknQJdfbh7mfs7zPwXNOugKZ3uyCVby1vxBBy16Tkg== X-Google-Smtp-Source: ABdhPJyc/MDglzj7ZqHuKLnfpO6vVPHNJJJjAhghObYaMjdvGQtxzeGy+jhwPjnJIpGZowWwyMtWi1MuD2fSyYUnfEo= X-Received: by 2002:ab0:7c5b:: with SMTP id d27mr407242uaw.15.1622734642855; Thu, 03 Jun 2021 08:37:22 -0700 (PDT) MIME-Version: 1.0 References: <20210602065345.355274-1-hch@lst.de> <20210602065345.355274-9-hch@lst.de> In-Reply-To: <20210602065345.355274-9-hch@lst.de> From: Ulf Hansson Date: Thu, 3 Jun 2021 17:36:45 +0200 Message-ID: Subject: Re: [PATCH 08/30] mspro: use blk_mq_alloc_disk To: Christoph Hellwig Content-Type: text/plain; charset="UTF-8" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Justin Sanders , Vignesh Raghavendra , Mike Snitzer , "Michael S. Tsirkin" , Jason Wang , virtualization@lists.linux-foundation.org, dm-devel@redhat.com, "Md. Haris Iqbal" , Miquel Raynal , Jack Wang , Tim Waugh , linux-s390@vger.kernel.org, Maxim Levitsky , Richard Weinberger , Christian Borntraeger , xen-devel@lists.xenproject.org, Ilya Dryomov , Vasily Gorbik , Alex Dubov , Konrad Rzeszutek Wilk , Heiko Carstens , Josef Bacik , Denis Efremov , nbd@other.debian.org, linux-block , ceph-devel@vger.kernel.org, Jens Axboe , Geoff Levand , linux-mmc , linux-mtd@lists.infradead.org, linuxppc-dev , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Wed, 2 Jun 2021 at 08:54, Christoph Hellwig wrote: > > Use the blk_mq_alloc_disk API to simplify the gendisk and request_queue > allocation. > > Signed-off-by: Christoph Hellwig Acked-by: Ulf Hansson Kind regards Uffe > --- > drivers/memstick/core/mspro_block.c | 26 +++++++++++--------------- > 1 file changed, 11 insertions(+), 15 deletions(-) > > diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c > index cf7fe0d58ee7..22778d0e24f5 100644 > --- a/drivers/memstick/core/mspro_block.c > +++ b/drivers/memstick/core/mspro_block.c > @@ -1205,21 +1205,17 @@ static int mspro_block_init_disk(struct memstick_dev *card) > if (disk_id < 0) > return disk_id; > > - msb->disk = alloc_disk(1 << MSPRO_BLOCK_PART_SHIFT); > - if (!msb->disk) { > - rc = -ENOMEM; > + rc = blk_mq_alloc_sq_tag_set(&msb->tag_set, &mspro_mq_ops, 2, > + BLK_MQ_F_SHOULD_MERGE); > + if (rc) > goto out_release_id; > - } > > - msb->queue = blk_mq_init_sq_queue(&msb->tag_set, &mspro_mq_ops, 2, > - BLK_MQ_F_SHOULD_MERGE); > - if (IS_ERR(msb->queue)) { > - rc = PTR_ERR(msb->queue); > - msb->queue = NULL; > - goto out_put_disk; > + msb->disk = blk_mq_alloc_disk(&msb->tag_set, card); > + if (IS_ERR(msb->disk)) { > + rc = PTR_ERR(msb->disk); > + goto out_free_tag_set; > } > - > - msb->queue->queuedata = card; > + msb->queue = msb->disk->queue; > > blk_queue_max_hw_sectors(msb->queue, MSPRO_BLOCK_MAX_PAGES); > blk_queue_max_segments(msb->queue, MSPRO_BLOCK_MAX_SEGS); > @@ -1228,10 +1224,10 @@ static int mspro_block_init_disk(struct memstick_dev *card) > > msb->disk->major = major; > msb->disk->first_minor = disk_id << MSPRO_BLOCK_PART_SHIFT; > + msb->disk->minors = 1 << MSPRO_BLOCK_PART_SHIFT; > msb->disk->fops = &ms_block_bdops; > msb->usage_count = 1; > msb->disk->private_data = msb; > - msb->disk->queue = msb->queue; > > sprintf(msb->disk->disk_name, "mspblk%d", disk_id); > > @@ -1247,8 +1243,8 @@ static int mspro_block_init_disk(struct memstick_dev *card) > msb->active = 1; > return 0; > > -out_put_disk: > - put_disk(msb->disk); > +out_free_tag_set: > + blk_mq_free_tag_set(&msb->tag_set); > out_release_id: > mutex_lock(&mspro_block_disk_lock); > idr_remove(&mspro_block_disk_idr, disk_id); > -- > 2.30.2 >