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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE111C4332F for ; Wed, 23 Nov 2022 16:25:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238054AbiKWQZl (ORCPT ); Wed, 23 Nov 2022 11:25:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238960AbiKWQZg (ORCPT ); Wed, 23 Nov 2022 11:25:36 -0500 Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DABB28FB0F for ; Wed, 23 Nov 2022 08:25:34 -0800 (PST) Received: by mail-qt1-x834.google.com with SMTP id h24so11526927qta.9 for ; Wed, 23 Nov 2022 08:25:34 -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=w2tciLqcwsQTCzbhhhy0QC5/UYY1BCdS/JKudrlgXWsdMJrQOFL/wt5Ab7ZGYrYmTd h8mG5Rsl6mCjETzNhhYQZ6b/D1WBZFMiAKi9VRl/0Jb+bJ9QCy75e4habw71UCbIEITP sjxb5e9QxmuxJGPfgHulsfkerDVCtxZhDq7nBh6sv8lz+djrRA1t8P0gxfhWYVd8CdSE m8IouM8+0tHJYYJro/aBwxKlux/PEwVXjh/0lmYkW7Tu5geVHrGageLfJpxv2iawINTz A/zhGAFnD7FGa/EPBsmS3YxlZ+ShEpjDLTwTdeI1TcwJ6whSBKPiURaiY4r3iP/ENnt4 BRrw== X-Gm-Message-State: ANoB5pkG/x3i6/Ingh2rapQzYV0OmKmS43iO3LlSPANpVUPgZoeKRHdc iKql42mHBD4eYL4tk4y08l/i2g== 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 Cc: Matthew Wilcox , Maximilian Luz , Andy Shevchenko , 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 , "Martin K. Petersen" , Chaitanya Kulkarni , Ming Lei , Jilin Yuan , Alan Stern , Sakari Ailus , 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> <97be39ed-3cea-d55a-caa6-c2652baef399@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 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