[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z1I-A0Rhc8AHhvtw@agluck-desk3>
Date: Thu, 5 Dec 2024 15:57:55 -0800
From: "Luck, Tony" <tony.luck@...el.com>
To: Kyle Meyer <kyle.meyer@....com>
Cc: bp@...en8.de, james.morse@....com, mchehab@...nel.org, rric@...nel.org,
linux-edac@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] EDAC/{i10nm,skx,skx_common}: Support multiple clumps
> +int skx_get_src_id(struct skx_dev *d, int off, u8 *id)
> +{
> +#ifdef CONFIG_NUMA
> + return skx_get_pkg_id(d, id);
> +#else
> + u32 reg;
> +
> + if (pci_read_config_dword(d->util_all, off, ®)) {
> + skx_printk(KERN_ERR, "Failed to read src id\n");
> + return -ENODEV;
> + }
> +
> + *id = GET_BITFIELD(reg, 12, 14);
> + return 0;
> +#endif
Doh ... I alwasy forget about IS_ENABLED(). This can be written:
int skx_get_src_id(struct skx_dev *d, int off, u8 *id)
{
u32 reg;
if (IS_ENABLED(CONFIG_NUMA))
return skx_get_pkg_id(d, id);
if (pci_read_config_dword(d->util_all, off, ®)) {
skx_printk(KERN_ERR, "Failed to read src id\n");
return -ENODEV;
}
*id = GET_BITFIELD(reg, 12, 14);
return 0;
}
-Tony
Powered by blists - more mailing lists