Message ID | 20240111151226.842603-4-nfraprado@collabora.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Allow coreboot modules to autoload and enable cbmem in the arm64 defconfig | expand |
On Thu, Jan 11, 2024 at 12:11:48PM -0300, Nícolas F. R. A. Prado wrote: > Create an id table and add it to the module device table to allow the > cbmem driver to be automatically loaded when a matching device is found. > > Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Might as well also patch framebuffer-coreboot.c and memconsole-coreboot.c while you're at it? But for this one: Acked-by: Brian Norris <briannorris@chromium.org>
On Thu, Jan 11, 2024 at 04:38:44PM -0800, Brian Norris wrote: > On Thu, Jan 11, 2024 at 12:11:48PM -0300, Nícolas F. R. A. Prado wrote: > > Create an id table and add it to the module device table to allow the > > cbmem driver to be automatically loaded when a matching device is found. > > > > Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> > > Might as well also patch framebuffer-coreboot.c and > memconsole-coreboot.c while you're at it? Yeah, no reason not to. Will do in v2. Thanks, Nícolas
Hi Nícolas, kernel test robot noticed the following build warnings: [auto build test WARNING on next-20240111] [also build test WARNING on v6.7] [cannot apply to chrome-platform/for-next chrome-platform/for-firmware-next masahiroy-kbuild/for-next masahiroy-kbuild/fixes arm64/for-next/core linus/master v6.7 v6.7-rc8 v6.7-rc7] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/N-colas-F-R-A-Prado/firmware-coreboot-Generate-modalias-uevent-for-devices/20240111-231841 base: next-20240111 patch link: https://lore.kernel.org/r/20240111151226.842603-4-nfraprado%40collabora.com patch subject: [PATCH 3/4] firmware: google: cbmem: Add to module device table config: i386-randconfig-013-20240115 (https://download.01.org/0day-ci/archive/20240115/202401151013.Xioj5wZo-lkp@intel.com/config) compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240115/202401151013.Xioj5wZo-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202401151013.Xioj5wZo-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/firmware/google/cbmem.c:118:40: warning: unused variable 'cbmem_ids' [-Wunused-const-variable] 118 | static const struct coreboot_device_id cbmem_ids[] = { | ^~~~~~~~~ 1 warning generated. vim +/cbmem_ids +118 drivers/firmware/google/cbmem.c 117 > 118 static const struct coreboot_device_id cbmem_ids[] = { 119 { .tag = LB_TAG_CBMEM_ENTRY }, 120 { /* sentinel */ } 121 }; 122 MODULE_DEVICE_TABLE(coreboot, cbmem_ids); 123
Hi Nicolas, On Mon, Jan 15, 2024 at 10:53:48AM +0800, kernel test robot wrote: > All warnings (new ones prefixed by >>): > > >> drivers/firmware/google/cbmem.c:118:40: warning: unused variable 'cbmem_ids' [-Wunused-const-variable] > 118 | static const struct coreboot_device_id cbmem_ids[] = { > | ^~~~~~~~~ > 1 warning generated. > > > vim +/cbmem_ids +118 drivers/firmware/google/cbmem.c > > 117 > > 118 static const struct coreboot_device_id cbmem_ids[] = { > 119 { .tag = LB_TAG_CBMEM_ENTRY }, > 120 { /* sentinel */ } > 121 }; > 122 MODULE_DEVICE_TABLE(coreboot, cbmem_ids); > 123 I was wondering why we have a seemingly unique "unused variable" failure mode in comparison to other similarly-structured device/bus drivers, and I realized that's because we're not relying on the same structure for both MODULE_DEVICE_TABLE (struct coreboot_device_id) and for the driver definition (struct coreboot_driver -> 'u32 tag'). Thus, this structure is only used for #define MODULE builds, and otherwise not used. Rather than wrapping these definitions in "#ifdef MODULE", perhaps we can settle on a single field, and replace `struct coreboot_driver::tag` with an instance of `struct coreboot_device_id`? That would normally be a breaking change that would require changing all drivers at the same time as the bus (or else some kind of intermediate transition state), but considering there are only 4 driver implementations and they all live under the same maintainer tree, that seems like it should still be OK (IMO). If it makes the series more readable/incremental, perhaps the switchover can be the last patch in the series, and there can remain some duplication (and potential -Wunused-const-variable issues) for the middle of the series. Brian
diff --git a/drivers/firmware/google/cbmem.c b/drivers/firmware/google/cbmem.c index 88e587ba1e0d..ceb89b4cdbe0 100644 --- a/drivers/firmware/google/cbmem.c +++ b/drivers/firmware/google/cbmem.c @@ -13,6 +13,7 @@ #include <linux/kernel.h> #include <linux/kobject.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/platform_device.h> #include <linux/slab.h> #include <linux/sysfs.h> @@ -114,6 +115,12 @@ static int cbmem_entry_probe(struct coreboot_device *dev) return 0; } +static const struct coreboot_device_id cbmem_ids[] = { + { .tag = LB_TAG_CBMEM_ENTRY }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(coreboot, cbmem_ids); + static struct coreboot_driver cbmem_entry_driver = { .probe = cbmem_entry_probe, .drv = {
Create an id table and add it to the module device table to allow the cbmem driver to be automatically loaded when a matching device is found. Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> --- drivers/firmware/google/cbmem.c | 7 +++++++ 1 file changed, 7 insertions(+)