Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7379049rwb; Wed, 23 Nov 2022 05:58:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf4iPdVzwWu1gMIOoXVg/DgIQkWK12aGr7i7zsqMqdtES1Iy8xmNiYHUJcv3MVPo2kffL0zg X-Received: by 2002:a17:906:9da4:b0:7ae:100a:8dc0 with SMTP id fq36-20020a1709069da400b007ae100a8dc0mr22832034ejc.424.1669211916182; Wed, 23 Nov 2022 05:58:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669211916; cv=none; d=google.com; s=arc-20160816; b=DWBr2FKhaEBNWMLr8t7WwjxC0e0B7raDYwoRq8pGTCqZ8Km1VjkqEtUOjlG6StomQd gne9Cgql5/PUMzxAjpaQbIM7IbsE2tdQBmSjq+bdR4zD2eox5Mls2V6HALyS1KQuvFtK 56JLBIyK/a5fU9+oiPAHt6qEoC14iD2wskLIcTP5oJBuIe8AofqSlBtcKeEYThxMHsM8 i2skW4gxKJVggd38DpM53jPhRtghXJYHXsZJwVTquPgd/Pxvs/mgjGNYoCcEZiBJjZYY /gwHrf3lcJl8DURupOW4oEBxg1rdfo+CjslkCkBAuZEpFAhocDwQpCqn8mcwk5UnTGXs bvNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=JYgLkrWjsw3Ve0GvOu6TkHvqSOpCModASgssNC0DY58=; b=b5V4RjYbJvzIXVHE3Uyy69LgoI0jq0Q95pcEU4mJhcnqYvSjNoiGbYiweU12yyJpQW u05yRp9Nna1eG2mnSilcXLASYsvF3Px6KLyhZZvhWV20XEb2ZTo6abzGUVAI2adYDb7m x7f4cqH9Ugr+kdLL0LFJajzc72zkeqLgCh7gmdEaKlo0GCtIcmPXljY9YrJYAh9iI0O3 gTPIUqPKrcEW/VusZIIGCf8Fp8+v4fUtzcjNKE+0yLwsfteXeXAYUqsiC53PBOH8MlWI Clye5b1L9w2IbMCDPPbTaereuiSbL5fBGhNbzkesl1A00WNuSlJfRwhGbD9cDZpa46iN 2Xrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=K0VulbJs; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt20-20020a1709072d9400b007879bb73291si10176848ejc.807.2022.11.23.05.58.07; Wed, 23 Nov 2022 05:58:36 -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=@intel.com header.s=Intel header.b=K0VulbJs; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237347AbiKWNqn (ORCPT + 89 others); Wed, 23 Nov 2022 08:46:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238294AbiKWNqX (ORCPT ); Wed, 23 Nov 2022 08:46:23 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF348E1BE2; Wed, 23 Nov 2022 05:35:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669210511; x=1700746511; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=0dPBcIou1yq73/ShQ5ge15FFqP86cP4E6nEb250ZlWo=; b=K0VulbJse9A41zXVuIsWR7lzJIvxf452Y/g1P8EMxHuL+btsI7aM3y8g 4hu3WE7R0y8r6UT25oFPCjvB8Y3zJAqwRZUo6e+5sh+cqimY+9hcOIZjP 1uhFex2g8IM2Xd+GSSilm0JvUEZvUfrmb4ShSHiXxf/ezdABFKlSfDeWu 4feQg7/L4xhIc/4kQ/CvX0/Bxkvrbw7OpG3XDvx4wHthR67aWmoqhQQ1M sbduSworxN5Hh0AqGJaM9uKQnyscUmjTAOXZbk2Eml70UjkuKpOieGHca KhTnzFGJYby8bacvFtpsPfbbP53L9uL4Dwr/nA0axACal1PiyaEnwf2Wo A==; X-IronPort-AV: E=McAfee;i="6500,9779,10539"; a="312766025" X-IronPort-AV: E=Sophos;i="5.96,187,1665471600"; d="scan'208";a="312766025" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2022 05:35:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10539"; a="970863671" X-IronPort-AV: E=Sophos;i="5.96,187,1665471600"; d="scan'208";a="970863671" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga005.fm.intel.com with ESMTP; 23 Nov 2022 05:35:00 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1oxptw-00GImp-12; Wed, 23 Nov 2022 15:34:56 +0200 Date: Wed, 23 Nov 2022 15:34:56 +0200 From: Andy Shevchenko To: Maximilian Luz Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Jens Axboe , "Rafael J. Wysocki" , Len Brown , Stefan Richter , Wolfram Sang , Alexandre Belloni , Dmitry Torokhov , Sean Young , Mauro Carvalho Chehab , Rob Herring , Frank Rowand , Hans de Goede , Mark Gross , Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale , Andreas Noever , Michael Jamet , Mika Westerberg , Yehezkel Bernat , Jiri Slaby , Heikki Krogerus , "Matthew Wilcox (Oracle)" , "Martin K. Petersen" , Chaitanya Kulkarni , Ming Lei , Jilin Yuan , Alan Stern , Sakari Ailus , Jason Gunthorpe , Thomas Gleixner , Ira Weiny , Dan Williams , Won Chung , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-block@vger.kernel.org, linux-i2c@vger.kernel.org, linux-i3c@lists.infradead.org, linux-input@vger.kernel.org, linux-media@vger.kernel.org, linux-serial@vger.kernel.org, linux-usb@vger.kernel.org, linux1394-devel@lists.sourceforge.net, platform-driver-x86@vger.kernel.org Subject: Re: [PATCH 3/5] driver core: make struct device_type.uevent() take a const * Message-ID: References: <20221123122523.1332370-1-gregkh@linuxfoundation.org> <20221123122523.1332370-3-gregkh@linuxfoundation.org> <711d5275-7e80-c00d-0cdc-0f3d52175361@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <711d5275-7e80-c00d-0cdc-0f3d52175361@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 On Wed, Nov 23, 2022 at 02:14:31PM +0100, Maximilian Luz wrote: > On 11/23/22 13:25, Greg Kroah-Hartman wrote: > > The uevent() callback in struct device_type 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 all relevant subsystems that use > > this callback. [...] > > -static inline struct ssam_device *to_ssam_device(struct device *d) > > +static inline struct ssam_device *to_ssam_device(const struct device *d) > > { > > return container_of(d, struct ssam_device, dev); > > } > > I am slightly conflicted about this change as that now more or less > implicitly drops the const. So I'm wondering if it wouldn't be better to > either create a function specifically for const pointers or to just > open-code it in the instance above. > > I guess we could also convert this to a macro. Then at least there > wouldn't be an explicit and potentially misleading const-conversion > indicated in the function signature. This is an intermediate step as far as I know since moving container_of to recognize const is a bit noisy right now. I guess you can find a discussion on the topic between Greg and Sakari. -- With Best Regards, Andy Shevchenko