From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753392AbdL1MAA (ORCPT ); Thu, 28 Dec 2017 07:00:00 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:43642 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751431AbdL1L76 (ORCPT ); Thu, 28 Dec 2017 06:59:58 -0500 X-Google-Smtp-Source: ACJfBotrOgEE+rv1R344fv7Z+7vjL7gRZ5zZSptHcJavEarpz9nbAp17fjh6p7khYmjUm3aqk+Tzrg== Date: Thu, 28 Dec 2017 12:59:55 +0100 From: Ingo Molnar To: Julia Lawall Cc: Andy Shevchenko , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Andi Kleen , linux-kernel@vger.kernel.org, Darren Hart , platform-driver-x86@vger.kernel.org, Bhumika Goyal Subject: Re: [PATCH v1] x86/platform/intel-mid: Revert "Make 'bt_sfi_data' const" Message-ID: <20171228115955.3rkmzf4gi47hpt63@gmail.com> References: <20171228100801.67744-1-andriy.shevchenko@linux.intel.com> <20171228102812.cm7yylrrq2omfw5y@gmail.com> <20171228111216.6ebgmcdert4lgkof@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Julia Lawall wrote: > > So the type is the following, in include/linux/mod_devicetable.h: > > > > struct x86_cpu_id { > > __u16 vendor; > > __u16 family; > > __u16 model; > > __u16 feature; /* bit index */ > > kernel_ulong_t driver_data; > > }; > > > > Is there a syntactic method that would allow the conversion to kernel_ulong_t, but > > would preserve any const-ness? > > > > Barring that, maybe we could convert driver_data to 'void *', fix up all users, > > and not force the type - this would allow the preservation of the const attribute, > > I think. > > > > BTW., a quick grep suggests similar type casting patterns here: > > > > arch/x86/platform/intel-mid/pwr.c: { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PENWELL), (kernel_ulong_t)&pnw_info }, > > arch/x86/platform/intel-mid/pwr.c: { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER), (kernel_ulong_t)&tng_info }, > > Would it be acceptable to move the cast out of the macro to the place > where the variable is referenced? It wouldn't help with the compiler, but > it would be slightly easier for the human to check. It would really be preferably to not stand in the way of the compiler here. AFACS void * should solve the problem, and it's a kernel_ulong_t equivalent in terms of with, right? So let's try and solve this for real. Forcing humans to discover such things is always a fragile concept. Thanks, Ingo