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 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B81C7C4332F for ; Sat, 26 Nov 2022 08:00:38 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BC2E517BF; Sat, 26 Nov 2022 08:59:46 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BC2E517BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669449636; bh=qWzZYH9hobYJ9k4ccqf32LxYbS7Tr5JzjoLAU1AtyM8=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=qM87mu6DgnEeR8AtV1lhsN0IzNrGlIaKQBjM/pylUieDU+0+4TLQ3FovR2i9oZ0mn VHk5fbv+deSdCQy+uh5COjNPaFYq3Czykw+1ewLpD6nYUqR1QosvjFHxAqrikmQnYF MH2vKQH1NvQdAayRlqWYEijwIxEsghA43ZkllgVE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D09B4F80557; Sat, 26 Nov 2022 08:58:56 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D9405F80115; Wed, 23 Nov 2022 17:25:38 +0100 (CET) Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3107EF80115 for ; Wed, 23 Nov 2022 17:25:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3107EF80115 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="ebGDyq+q" Received: by mail-qt1-x836.google.com with SMTP id a27so11512305qtw.10 for ; Wed, 23 Nov 2022 08:25:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=PhJSJnLVsP1vBula4KCFSx5kBTht7CuZrspFHU0N884=; b=ebGDyq+q12UGY7Qk5Tupc9qhDLGyIcTZVkm5UZYo/563kMYJJqyAeOt5CzUtM4J8DZ 3trFHny8FIDylUgXR9JjN8PS72NcWsvrDfr1Nd1Q7FDnTR43onbW+jw1+Ctw0cwtwrCd T18F6CTTWbwHWY6WrhS9prZWxtXaTjwzs7IQnIsjaZTmFdCmKdzeecD0BbnuyMQqVQVg z0s4POzfjTxMQ62r8mCHZM0rSmjmaRN4hzlYV7zdZbP1xMXxym5gxZ3SKz4kt6tgYYum EfCUt6/g2D4WDco0MNWeSPD0NJ6lencxZ7NqZJCJlD8ikZ4WiUl7N0yJnMd2Q4wIPSG2 7pnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=PhJSJnLVsP1vBula4KCFSx5kBTht7CuZrspFHU0N884=; b=maY/hv2ca1Sb5uUmjm4snF20Gf3tHbs3Sx26OcHcGrxroLeBgTHLizLUfCbX4TSLEB T4IUnbg9CDpr01pfJpMg3opQZLgs9xoSr82l/OoMR51UdtlIvAFbwCS9xOUDWj1uuXh7 zwl34Orlexfxf9NZ6su8yyoNG9HvENjfdiw7V8AgLTgHSSj+qZT2etQAunXci/IuYPmc fGa0Ve27TNhDUonj6BIshHjCQDtrcdhQHHMwmNeIHLqsADPWcEqTPJdKHU8B63lp1bR1 pRifNFO3LFRUB0ScuzeZPBcN4UXuT+F9tfQn8MJdl3q/+FOGQOiSxWFT4lBqPqze7+2y 7+cA== X-Gm-Message-State: ANoB5pk4n/JG4b9E6NMdVUobCRV/6O9LNHdLBOjM9WCoVR/dbXuvVxUP W8kyZ+RwtYxk5nmwUU161OEZuA== X-Google-Smtp-Source: AA0mqf7URgWK3LZKBiCOJvrYX2BcRTBThzd2VlaYXoILbXTQHzjAWJMWnGzlcI0wVuCFvjEWzX6GjA== X-Received: by 2002:ac8:60c:0:b0:3a6:37bd:ace5 with SMTP id d12-20020ac8060c000000b003a637bdace5mr14127789qth.426.1669220734011; Wed, 23 Nov 2022 08:25:34 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-47-55-122-23.dhcp-dynamic.fibreop.ns.bellaliant.net. [47.55.122.23]) by smtp.gmail.com with ESMTPSA id q7-20020a05620a0d8700b006f8665f483fsm12561497qkl.85.2022.11.23.08.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 08:25:33 -0800 (PST) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1oxsZ2-00AOLL-MZ; Wed, 23 Nov 2022 12:25:32 -0400 Date: Wed, 23 Nov 2022 12:25:32 -0400 From: Jason Gunthorpe To: Greg Kroah-Hartman 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> <97be39ed-3cea-d55a-caa6-c2652baef399@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailman-Approved-At: Sat, 26 Nov 2022 08:58:52 +0100 Cc: Alexandre Belloni , Heikki Krogerus , Sean Young , "Rafael J. Wysocki" , alsa-devel@alsa-project.org, platform-driver-x86@vger.kernel.org, linux-i2c@vger.kernel.org, Andreas Noever , linux-i3c@lists.infradead.org, linux1394-devel@lists.sourceforge.net, Frank Rowand , Dan Williams , Andy Shevchenko , Bard Liao , Pierre-Louis Bossart , Matthew Wilcox , linux-acpi@vger.kernel.org, Alan Stern , linux-serial@vger.kernel.org, linux-input@vger.kernel.org, Won Chung , Len Brown , devicetree@vger.kernel.org, Chaitanya Kulkarni , Ira Weiny , Michael Jamet , Ming Lei , Mark Gross , Hans de Goede , Rob Herring , Jiri Slaby , Thomas Gleixner , Mauro Carvalho Chehab , Mika Westerberg , Jens Axboe , linux-block@vger.kernel.org, Jilin Yuan , "Martin K. Petersen" , Dmitry Torokhov , linux-kernel@vger.kernel.org, Wolfram Sang , Vinod Koul , Stefan Richter , Sakari Ailus , Yehezkel Bernat , Sanyog Kale , linux-media@vger.kernel.org, Maximilian Luz , linux-usb@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Wed, Nov 23, 2022 at 04:37:59PM +0100, Greg Kroah-Hartman wrote: > static inline struct device *__kobj_to_dev(struct kobject *kobj) > { > return container_of(kobj, struct device, kobj); > } > > static inline const struct device *__kobj_to_dev_const(const struct kobject *kobj) > { > return container_of(kobj, const struct device, kobj); > } > > /* > * container_of() will happily take a const * and spit back a non-const * as it > * is just doing pointer math. But we want to be a bit more careful in the > * driver code, so manually force any const * of a kobject to also be a const * > * to a device. > */ > #define kobj_to_dev(kobj) \ > _Generic((kobj), \ > const struct kobject *: __kobj_to_dev_const, \ > struct kobject *: __kobj_to_dev)(kobj) > > > Want me to do the same thing here as well? It would be nice to have a shared macro code gen all of the above instead of copy and pasting it. Then maybe other cases beyond struct device could adopt const too.. Jason