Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

firmware: dmi-sysfs: handle HAS_IOPORT=n

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. We thus need to guard sections of code calling them
as alternative access methods.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Link: https://lore.kernel.org/r/20230522105049.1467313-11-schnelle@linux.ibm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Niklas Schnelle and committed by
Greg Kroah-Hartman
e7f3dd80 67d91a1e

+4
+4
drivers/firmware/dmi-sysfs.c
··· 310 310 .default_groups = dmi_sysfs_sel_groups, 311 311 }; 312 312 313 + #ifdef CONFIG_HAS_IOPORT 313 314 typedef u8 (*sel_io_reader)(const struct dmi_system_event_log *sel, 314 315 loff_t offset); 315 316 ··· 375 374 376 375 return wrote; 377 376 } 377 + #endif 378 378 379 379 static ssize_t dmi_sel_raw_read_phys32(struct dmi_sysfs_entry *entry, 380 380 const struct dmi_system_event_log *sel, ··· 411 409 memcpy(&sel, dh, sizeof(sel)); 412 410 413 411 switch (sel.access_method) { 412 + #ifdef CONFIG_HAS_IOPORT 414 413 case DMI_SEL_ACCESS_METHOD_IO8: 415 414 case DMI_SEL_ACCESS_METHOD_IO2x8: 416 415 case DMI_SEL_ACCESS_METHOD_IO16: 417 416 return dmi_sel_raw_read_io(entry, &sel, state->buf, 418 417 state->pos, state->count); 418 + #endif 419 419 case DMI_SEL_ACCESS_METHOD_PHYS32: 420 420 return dmi_sel_raw_read_phys32(entry, &sel, state->buf, 421 421 state->pos, state->count);