From patchwork Wed Nov 9 14:48:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 17617 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp378267wru; Wed, 9 Nov 2022 06:54:45 -0800 (PST) X-Google-Smtp-Source: AMsMyM4pHjauxZayJLwFMjX3SQL0HadFnHoI51TxMnqMM2mHn7Ju/zGOn03IvaFvpo33vBL2ipgp X-Received: by 2002:a63:4656:0:b0:457:523c:57ad with SMTP id v22-20020a634656000000b00457523c57admr53261086pgk.318.1668005684841; Wed, 09 Nov 2022 06:54:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668005684; cv=none; d=google.com; s=arc-20160816; b=FX1y54r5tqup1B/iG0WqefxkrgY6LoKcpJS1PptQYLCf9xTFl6on9NJTbQWDCWSzqi 0QMUYKCqPJwwsmATd1bZZXCVmVLtppQDQ4/daKO4mE5s8UmSPITStLHTrmH5TBi2GCwi CG5TPOUGJHYrILe7lhcYJtDf06N7eNZuP6zMkqu67l9YKr1ZRTWj/7tz4QGt9nJwCXsq CZQB7HSvC8xNlDwkufj/uDlMN/WUqHC79ShzvU87AMBVuCVJ/UI0s+0O/nwb+ZWd3nhw 7mHrkxSfC+sy5BR7mIZn02/5m6housBPF5uerloI9tppwj3p9FtBIm8y+QcGZozZ+kbU Fofw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=1FQf5rTGvqi8Ig47r25795Vsdat/f2zXuXHuSAC1iKE=; b=G6C1mL4yaAHGhNWm3YPDF60GC2BhYKVtzOsDnULDz8SkygGxY8wUswCGp0NwVp/SXP 6nMsjU3F8haAp3+exlPQWUTu8/wBQrmn1si6JCeAZr4TYQfhYDmkq8WnK5NkpsoR+Cni GMcjhe200xYhbwjxn4953xqc0wtOBl/P9a0wWkbtSz/JEji77ky4WhkkUpj2+xzOKyf4 l2fPJ3/fwTVFHg9qYdLr/qHOdj1qnd4PZeQp/+IxLD2FQfqdL7SMBQWhbwXFE0DGSCoB Cyum/aIZpLmu/vJ+dx3jor0lfe6Em+YPci5FIH05IqPOFBSESeZEUgJkqr+MqkPeTt1p 9K2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="cEtUq/5X"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nh17-20020a17090b365100b00212f86579f8si1302016pjb.111.2022.11.09.06.54.32; Wed, 09 Nov 2022 06:54:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="cEtUq/5X"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230071AbiKIOtB (ORCPT + 99 others); Wed, 9 Nov 2022 09:49:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231665AbiKIOsu (ORCPT ); Wed, 9 Nov 2022 09:48:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBEFF12AFF; Wed, 9 Nov 2022 06:48:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5ED61617EF; Wed, 9 Nov 2022 14:48:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63E4AC433D6; Wed, 9 Nov 2022 14:48:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1668005328; bh=W0WuuVf8t/q9rQq3isA02nICwNHjjQivDzXXjUr4+hI=; h=From:To:Cc:Subject:Date:From; b=cEtUq/5XQkgmL1ADq2JFNbtjqCzbfmRQ5eFD5wqP1b7kTgoDvMBponlnkSf3DLTXt aRjd1EZICr/EAjjuulNSElaiCy32Wts4Doe2bbST5RHDTecXts8lTNBGVe8yXDzBmZ EtRnugnrrMFWgPXxkB2vEjU9+GjPmdF6d27H4Wyc= From: Greg Kroah-Hartman To: axboe@kernel.dk Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , linux-block@vger.kernel.org Subject: [PATCH] blkdev: make struct block_device_operations.devnode() take a const * Date: Wed, 9 Nov 2022 15:48:43 +0100 Message-Id: <20221109144843.679668-1-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1904; i=gregkh@linuxfoundation.org; h=from:subject; bh=W0WuuVf8t/q9rQq3isA02nICwNHjjQivDzXXjUr4+hI=; b=owGbwMvMwCRo6H6F97bub03G02pJDMnZe0/d42C7L3vGWUFj2uZDG6OPtR+KOLwlqrXd/B1LZbvG xq4VHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjARlX6G+b5R+nw/P2o+q87eynRXif N/bYOKOcNcqVTNeWtrHB0XXs/IrbFY6V2teSgTAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749030729311759695?= X-GMAIL-MSGID: =?utf-8?q?1749030729311759695?= The devnode() callback in struct block_device_operations should not be modifying the device that is passed into it, so mark it as a const * and propagate the function signature changes out into the one subsystem that actually uses this callback. Cc: linux-block@vger.kernel.org Cc: Jens Axboe Signed-off-by: Greg Kroah-Hartman Acked-by: Jens Axboe --- Jens, I have some dependent kobject/driver core changes that require this change in the works. Can I take this through the driver core tree for 6.2-rc1? drivers/block/pktcdvd.c | 2 +- include/linux/blkdev.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 4cea3b08087e..8dc15be95962 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -2632,7 +2632,7 @@ static unsigned int pkt_check_events(struct gendisk *disk, return attached_disk->fops->check_events(attached_disk, clearing); } -static char *pkt_devnode(struct gendisk *disk, umode_t *mode) +static char *pkt_devnode(const struct gendisk *disk, umode_t *mode) { return kasprintf(GFP_KERNEL, "pktcdvd/%s", disk->disk_name); } diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 50e358a19d98..2a455793462b 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1413,7 +1413,7 @@ struct block_device_operations { void (*swap_slot_free_notify) (struct block_device *, unsigned long); int (*report_zones)(struct gendisk *, sector_t sector, unsigned int nr_zones, report_zones_cb cb, void *data); - char *(*devnode)(struct gendisk *disk, umode_t *mode); + char *(*devnode)(const struct gendisk *disk, umode_t *mode); /* returns the length of the identifier or a negative errno: */ int (*get_unique_id)(struct gendisk *disk, u8 id[16], enum blk_unique_id id_type);