From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D5443AD50F for ; Fri, 17 Jul 2026 10:20:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784283606; cv=none; b=tdFctlAV5IwJEvoMIoRLwLumoF6qK5cg92slIX0KavqQ6Fk5tndOBrsGty2anZPDXsaqx7aqz/G89zxusTXDaweKLvSm+tpcBAbEM62GKAq21Ze8JqCVgZWSv3PcK9R/h1RZ8XOf7gH10lGtaOQCBcz1Xdi3rJKxaPigGWG0r6Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784283606; c=relaxed/simple; bh=X48u0GChV2WtJCkZHzZWPAdcC0E1zAWAZ1nzrpXvEgE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=olxXMgIAXWF+uV4+YcZ0I4D4rGwPHcPMgBAguONX0toZw4uVb1B+KufPgfxr371ocgv0qPzg5NlM6wyAuOSTwM8UHEzMmrbLOp2Nhe1tSzvw6vCnl08xBUUC4jzXi9QwMZ/2Uk/ck42/VYd3rknsqln1+WyXBy0BjZiINP5r3CU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=XiAHI7LU; arc=none smtp.client-ip=198.175.65.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XiAHI7LU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1784283602; x=1815819602; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=X48u0GChV2WtJCkZHzZWPAdcC0E1zAWAZ1nzrpXvEgE=; b=XiAHI7LUt+kl9dXs2QH8coADC6sNkiU9+q/EoKh3gu35uSn6czCGhOkG uTytFde7zxbM7epfOszhtuYYHSGZX8upl1HMExl3/tc5xVvqN/WP4kPqe aAFTD24Y0Ii52dGKJqIkU0x7PUs6s9vAB1l8f01e3dFhx6Lw6B1D5a/Lr VUt0jOYgBSsiAiXgVHOkQLGSa/Ds8Eqp8mQwPOMGA7ixHSqkUIZd4IcDP rN1ajC72jPSdOTaGfzgs1vjmCIELtS8awReD72+hY3Jtb7GXpzzYjL9zO qXFyRpoYaB8DsPzgzzaIGKQsl5/bFdBJhzSqvEr4bxhcpH/RY4I3X7D53 A==; X-CSE-ConnectionGUID: 11hNTOC3Tzqq0AmTrp2a+Q== X-CSE-MsgGUID: AAcg/HX8RWyS6RtAS4vriQ== X-IronPort-AV: E=McAfee;i="6800,10657,11848"; a="84980691" X-IronPort-AV: E=Sophos;i="6.25,169,1779174000"; d="scan'208";a="84980691" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2026 03:20:01 -0700 X-CSE-ConnectionGUID: zBwypI3rTAK4YvMvEXb4Tg== X-CSE-MsgGUID: /svgehoLTCe7BGMKvipM1g== X-ExtLoop1: 1 Received: from pgcooper-mobl3.ger.corp.intel.com (HELO localhost) ([10.245.245.143]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2026 03:19:58 -0700 Date: Fri, 17 Jul 2026 13:19:56 +0300 From: Andy Shevchenko To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig_=28The_Capable_Hub=29?= Cc: Andy Shevchenko , Andy Shevchenko , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org, Markus Schneider-Pargmann Subject: Re: [PATCH] x86/platform/intel-mid: Use named initializer for pci_device_id array Message-ID: References: <20260507154043.3113348-2-u.kleine-koenig@baylibre.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo On Fri, Jul 17, 2026 at 11:44:26AM +0200, Uwe Kleine-König (The Capable Hub) wrote: > On Sat, May 09, 2026 at 03:42:44PM +0200, Uwe Kleine-König (The Capable Hub) wrote: > > > My point is to put all burden in one place > > > id est PCI_DEVICE_DATA() macro, your point is to spread a churn all over > > > the kernel which I disagree with. > > > > In my approach the first step (U1) is: > > > > static const struct pci_device_id mid_pwr_pci_ids[] = { > > - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PENWELL), (kernel_ulong_t)&pnw_info }, > > - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER), (kernel_ulong_t)&tng_info }, > > + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PENWELL), .driver_data = (kernel_ulong_t)&pnw_info }, > > + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER), .driver_data = (kernel_ulong_t)&tng_info }, > > {} > > }; > > > > (i.e. the patch under discussion) and the second (U2) is > > > > static int mid_pwr_probe(struct pci_dev *pdev, const struct pci_device_id *id) > > { > > - struct mid_pwr_device_info *info = (void *)id->driver_data; > > + const struct mid_pwr_device_info *info = id->driver_data_ptr; > > struct device *dev = &pdev->dev; > > struct mid_pwr *pwr; > > int ret; > > ... > > static const struct pci_device_id mid_pwr_pci_ids[] = { > > - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PENWELL), .driver_data = (kernel_ulong_t)&pnw_info }, > > - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER), .driver_data = (kernel_ulong_t)&tng_info }, > > + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PENWELL), .driver_data_ptr = &pnw_info }, > > + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER), .driver_data_ptr = &tng_info }, > > {} > > }; > > > > . With your suggested approach we have instead of U1 the following (A1): > > > > static const struct pci_device_id mid_pwr_pci_ids[] = { > > - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PENWELL), (kernel_ulong_t)&pnw_info }, > > - { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER), (kernel_ulong_t)&tng_info }, > > + { PCI_DEVICE_DATA(INTEL, PENWELL), &pnw_info) }, > > + { PCI_DEVICE_DATA(INTEL, TANGIER), &tng_info) }, > > {} > > }; Yes. > > and to benefit later from the union there is still the first hunk of U2 > > needed (A2): > > > > static int mid_pwr_probe(struct pci_dev *pdev, const struct pci_device_id *id) > > { > > - struct mid_pwr_device_info *info = (void *)id->driver_data; > > + const struct mid_pwr_device_info *info = id->driver_data_ptr; > > struct device *dev = &pdev->dev; > > struct mid_pwr *pwr; > > int ret; Yes. > > . I was under the impression you assumed there is no need for A2, but > > that's wrong. Additionally U2 is easier to review and judge that is > > correct than A2 because it uses an indirection less, while A2 depends on > > .driver_data and .driver_data_ptr holding the same data. With my > > approach there is always a directly visible 1:1 correspondance between > > the array and the probe function. > > > > Also if A2 at a later point is backported to stable it applies just fine > > without A1 and the _Generic extention of PCI_DEVICE_DATA() and the added > > union. With my approach it's more obvious that you also need U1 before > > you can apply U2. (Yes, it still doesn't fail to apply without the added > > union to pci_device_id, but that's three potential papercuts with your > > approach vs. one with mine.) > > > > So I don't buy your argument that A1 + A2 is less churn than U1 + U2. In > > my book U1 + U2 is even less. > > You stopped replying to this discussion after my argumentation. Does > that mean I managed to convince you? Not at all, I am at strong opinion that PCI_DEVICE_DATA() is the right way to go with lesser churn. So, I do not like this patch. Please, consider using PCI_DEVICE_DATA(). > In that case, please consider applying the patch. I am not in the position of applying this patch, you should ask x86 maintainers for that. -- With Best Regards, Andy Shevchenko