mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

Andy reported: Debian clang version 19.1.7 is not happy when compiled with `make W=1` (note, CONFIG_WERROR=y is the default): ipmi_si_platform.c:268:15: error: cast to smaller integer type 'enum si_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] 268 | io.si_type = (enum si_type)device_get_match_data(&pdev->dev); The IPMI SI type is an enum that was cast into a pointer that was then cast into an enum again. That's not the greatest style, so instead create an info structure to hold the data and use that. Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Closes: https://lore.kernel.org/lkml/20250415085156.446430-1-andriy.shevchenko@linux.intel.com/ Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Corey Minyard <corey@minyard.net>
115 lines
3.1 KiB
C
115 lines
3.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/*
|
|
* ipmi_si.h
|
|
*
|
|
* Interface from the device-specific interfaces (OF, DMI, ACPI, PCI,
|
|
* etc) to the base ipmi system interface code.
|
|
*/
|
|
|
|
#ifndef __IPMI_SI_H__
|
|
#define __IPMI_SI_H__
|
|
|
|
#include <linux/ipmi.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/platform_device.h>
|
|
|
|
#define SI_DEVICE_NAME "ipmi_si"
|
|
|
|
#define DEFAULT_REGSPACING 1
|
|
#define DEFAULT_REGSIZE 1
|
|
|
|
/* Numbers in this enumerator should be mapped to si_to_str[] */
|
|
enum si_type {
|
|
SI_TYPE_INVALID, SI_KCS, SI_SMIC, SI_BT, SI_TYPE_MAX
|
|
};
|
|
|
|
/* Array is defined in the ipmi_si_intf.c */
|
|
extern const char *const si_to_str[];
|
|
|
|
struct ipmi_match_info {
|
|
enum si_type type;
|
|
};
|
|
|
|
extern const struct ipmi_match_info ipmi_kcs_si_info;
|
|
extern const struct ipmi_match_info ipmi_smic_si_info;
|
|
extern const struct ipmi_match_info ipmi_bt_si_info;
|
|
|
|
enum ipmi_addr_space {
|
|
IPMI_IO_ADDR_SPACE, IPMI_MEM_ADDR_SPACE
|
|
};
|
|
|
|
/*
|
|
* The structure for doing I/O in the state machine. The state
|
|
* machine doesn't have the actual I/O routines, they are done through
|
|
* this interface.
|
|
*/
|
|
struct si_sm_io {
|
|
unsigned char (*inputb)(const struct si_sm_io *io, unsigned int offset);
|
|
void (*outputb)(const struct si_sm_io *io,
|
|
unsigned int offset,
|
|
unsigned char b);
|
|
|
|
/*
|
|
* Generic info used by the actual handling routines, the
|
|
* state machine shouldn't touch these.
|
|
*/
|
|
void __iomem *addr;
|
|
unsigned int regspacing;
|
|
unsigned int regsize;
|
|
unsigned int regshift;
|
|
enum ipmi_addr_space addr_space;
|
|
unsigned long addr_data;
|
|
enum ipmi_addr_src addr_source; /* ACPI, PCI, SMBIOS, hardcode, etc. */
|
|
union ipmi_smi_info_union addr_info;
|
|
|
|
int (*io_setup)(struct si_sm_io *info);
|
|
void (*io_cleanup)(struct si_sm_io *info);
|
|
unsigned int io_size;
|
|
|
|
int irq;
|
|
int (*irq_setup)(struct si_sm_io *io);
|
|
void *irq_handler_data;
|
|
void (*irq_cleanup)(struct si_sm_io *io);
|
|
|
|
u8 slave_addr;
|
|
const struct ipmi_match_info *si_info;
|
|
struct device *dev;
|
|
};
|
|
|
|
int ipmi_si_add_smi(struct si_sm_io *io);
|
|
irqreturn_t ipmi_si_irq_handler(int irq, void *data);
|
|
void ipmi_irq_start_cleanup(struct si_sm_io *io);
|
|
int ipmi_std_irq_setup(struct si_sm_io *io);
|
|
void ipmi_irq_finish_setup(struct si_sm_io *io);
|
|
void ipmi_si_remove_by_dev(struct device *dev);
|
|
struct device *ipmi_si_remove_by_data(int addr_space, enum si_type si_type,
|
|
unsigned long addr);
|
|
void ipmi_hardcode_init(void);
|
|
void ipmi_si_hardcode_exit(void);
|
|
void ipmi_si_hotmod_exit(void);
|
|
int ipmi_si_hardcode_match(int addr_space, unsigned long addr);
|
|
void ipmi_si_platform_init(void);
|
|
void ipmi_si_platform_shutdown(void);
|
|
void ipmi_remove_platform_device_by_name(char *name);
|
|
|
|
extern struct platform_driver ipmi_platform_driver;
|
|
|
|
#ifdef CONFIG_PCI
|
|
void ipmi_si_pci_init(void);
|
|
void ipmi_si_pci_shutdown(void);
|
|
#else
|
|
static inline void ipmi_si_pci_init(void) { }
|
|
static inline void ipmi_si_pci_shutdown(void) { }
|
|
#endif
|
|
#ifdef CONFIG_PARISC
|
|
void ipmi_si_parisc_init(void);
|
|
void ipmi_si_parisc_shutdown(void);
|
|
#else
|
|
static inline void ipmi_si_parisc_init(void) { }
|
|
static inline void ipmi_si_parisc_shutdown(void) { }
|
|
#endif
|
|
|
|
int ipmi_si_port_setup(struct si_sm_io *io);
|
|
int ipmi_si_mem_setup(struct si_sm_io *io);
|
|
|
|
#endif /* __IPMI_SI_H__ */
|