Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp807312rwl; Fri, 24 Mar 2023 02:09:41 -0700 (PDT) Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HhwSKU9p X-Google-Smtp-Source: AKy350b7byWDJGq1pP5ixoqH2ZeYFqYn6zUY7BqHeprCY1AN2ZBE/MV0Y40tokEd8pGKyMcWLILj X-Received: by 2002:a17:90b:17c5:b0:23d:31c3:c98d with SMTP id me5-20020a17090b17c500b0023d31c3c98dmr2449082pjb.15.1679648981352; Fri, 24 Mar 2023 02:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679648981; cv=none; d=google.com; s=arc-20160816; b=HWeUcW64PN8nSSZSKcXg86YCo9OYb1LIg49CSbGuGnuIzrCp2fxBnqxXIT85Gs6ipp CWn1yVTuVElRUAiJO01f3qa/Ftc3s7aMELcalBnOP3BedzPxNawy749da6j1FwvAVDLj cQPM7VOs1WAl0zTGsRItILZX2eRwHQBgBFztVyFsNIcOLtpcl+9F7rz20v5Yjy0jeXIB b9LfbitOdjZzr6RHv2eY3RYAEgcHAvOgUNNOrnjf599wKUgRGVhgvRPxa91SsLTPakQc nfcOL8tm9TVQLDune2zbQDsvN9JrjeY1UweLazeodwsk6JsaKIe+wIjQi5HJ3gqvlN8z aVFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=rx5i4dbahMWuaa5Q92Rqkrb2J+Jsrg3PtJPDfAh5m9U=; b=Z/NFh/fPtA5dsfZCT4oDtSFYvdRsYA+J2WPGTpb+o+6PEnJ0Z0TjoTiwK1I9W1bXBZ pSbAuLo9hnCPwud8jf1rDthms34PJpwif4V9W/KPtRzLV/9/mvOJAHbwo6/xG7bVG4pM 38Wz/y8FOwll6AnsWjcnr8sSbiQa8ggDaHmb5z7/S6DG+upzWcp3IsZ94o7tZjglWcq3 VgceNUMnxDbTB1NuvlR2IBDf2QIeeUUC/H+arXE6HWUT2XABp2RBxL+dMehQDDXil4cv j7LMyejo+mtR4i22o0m5e4OH/RSZFqmR5SwNnEWGQdfOQME25E9E8JP8nSGl+Fg3JOaH oX+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HhwSKU9p; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o3-20020a17090ab88300b00228e80888c9si3994260pjr.14.2023.03.24.02.09.29; Fri, 24 Mar 2023 02:09:41 -0700 (PDT) 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=HhwSKU9p; 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 S231997AbjCXI6R (ORCPT + 99 others); Fri, 24 Mar 2023 04:58:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231987AbjCXI6L (ORCPT ); Fri, 24 Mar 2023 04:58:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BB9B2658F; Fri, 24 Mar 2023 01:57:47 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id 07606B82277; Fri, 24 Mar 2023 08:57:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34FF9C433D2; Fri, 24 Mar 2023 08:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1679648249; bh=ys+7yc4sUX1/Wx2eRmenuEDPnjFxIcQOIE/STjZHko4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HhwSKU9pyBrx2ROAjIW/p7RuF507eM0FSC69dHElcXrQf2yuqK/Xrbh/JXGQvjh3f PrWbnxo/K0ouYFnmNzaCNHLlxgdIIdiXRQTovhr24yxAOetZ6TZV3VLDOd4EGIngPJ DzoTmuN/gau0G7fgbnyeK5XTpLWCnYTi5GsmeCmA= Date: Fri, 24 Mar 2023 09:57:26 +0100 From: Greg Kroah-Hartman To: Fenghua Yu Cc: linux-kernel@vger.kernel.org, rafael@kernel.org, Dave Jiang , Vinod Koul , dmaengine@vger.kernel.org Subject: Re: [PATCH 32/36] dmaengine: idxd: use const struct bus_type * Message-ID: References: <20230313182918.1312597-1-gregkh@linuxfoundation.org> <20230313182918.1312597-32-gregkh@linuxfoundation.org> <76db3d98-2d09-54de-ab46-0ec9d743e05d@intel.com> <43c53ae9-6cc7-0fa7-584a-7720569179cf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <43c53ae9-6cc7-0fa7-584a-7720569179cf@intel.com> X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 On Thu, Mar 16, 2023 at 04:57:54PM -0700, Fenghua Yu wrote: > Hi, Greg, > > On 3/16/23 03:16, Greg Kroah-Hartman wrote: > > On Mon, Mar 13, 2023 at 12:07:27PM -0700, Fenghua Yu wrote: > > > Hi, Greg, > > > > > > On 3/13/23 11:29, Greg Kroah-Hartman wrote: > > > > In the functions unbind_store() and bind_store(), a struct bus_type * > > > > should be a const one, as the driver core bus functions used by this > > > > variable are expecting the pointer to be constant, and these functions > > > > do not modify the pointer at all. > > > > > > > > Cc: Fenghua Yu > > > > Cc: Dave Jiang > > > > Cc: Vinod Koul > > > > Cc: dmaengine@vger.kernel.org > > > > Signed-off-by: Greg Kroah-Hartman > > > > --- > > > > Note, this is a patch that is a prepatory cleanup as part of a larger > > > > series of patches that is working on resolving some old driver core > > > > design mistakes. It will build and apply cleanly on top of 6.3-rc2 on > > > > its own, but I'd prefer if I could take it through my driver-core tree > > > > so that the driver core changes can be taken through there for 6.4-rc1. > > > > > > > > drivers/dma/idxd/compat.c | 4 ++-- > > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/drivers/dma/idxd/compat.c b/drivers/dma/idxd/compat.c > > > > index 3df21615f888..5fd38d1b9d28 100644 > > > > --- a/drivers/dma/idxd/compat.c > > > > +++ b/drivers/dma/idxd/compat.c > > > > @@ -16,7 +16,7 @@ extern void device_driver_detach(struct device *dev); > > > > static ssize_t unbind_store(struct device_driver *drv, const char *buf, size_t count) > > > > { > > > > - struct bus_type *bus = drv->bus; > > > > + const struct bus_type *bus = drv->bus; > > > > struct device *dev; > > > > int rc = -ENODEV; > > > > @@ -32,7 +32,7 @@ static DRIVER_ATTR_IGNORE_LOCKDEP(unbind, 0200, NULL, unbind_store); > > > > static ssize_t bind_store(struct device_driver *drv, const char *buf, size_t count) > > > > { > > > > - struct bus_type *bus = drv->bus; > > > > + const struct bus_type *bus = drv->bus; > > > > struct device *dev; > > > > struct device_driver *alt_drv = NULL; > > > > int rc = -ENODEV; > > > > > > After applying this patch, warning is reported: > > > > > > drivers/dma/idxd/compat.c: In function ‘bind_store’: > > > drivers/dma/idxd/compat.c:47:47: warning: passing argument 2 of > > > ‘driver_find’ discards ‘const’ qualifier from pointer target type > > > [-Wdiscarded-qualifiers] > > > 47 | alt_drv = driver_find("idxd", bus); > > > | ^~~ > > > In file included from ./include/linux/device.h:32, > > > from drivers/dma/idxd/compat.c:6: > > > ./include/linux/device/driver.h:129:59: note: expected ‘struct bus_type *’ > > > but argument is of type ‘const struct bus_type *’ > > > 129 | struct bus_type *bus); > > > | ~~~~~~~~~~~~~~~~~^~~ > > > > > > Should the "bus" parameter in driver_find() definition be changed to const > > > as well to avoid the warning? > > > > Oops, yes, it needs an earlier patch in this series, sorry, I didn't > > call that out properly in the notes section of the patch. > > > > So I can just take this through my tree if that's ok. > > Sure. > > Acked-by: Fenghua Yu Great, thanks for this, I've now queued up the series in my tree. greg k-h