treewide: prefer __func__ over __FUNCTION__ and __PRETTY_FUNCTION__

__FUNCTION__ and __PRETTY_FUNCTION__ are gcc extensions that predate
the C99 __func__ identifier. scripts/checkpatch.pl emits a warning
for any new use of __FUNCTION__ and recommends __func__ instead. In
C (unlike C++) __PRETTY_FUNCTION__ is identical to __func__ because
C function names do not carry signature information, so the
distinction has no behavioural effect here. The majority of the tree
already uses __func__, but a handful of older files in arch/, board/,
boot/, drivers/, examples/ and include/ still carry the gcc spellings
(55 occurrences of __FUNCTION__ across 19 files plus one
__PRETTY_FUNCTION__ in drivers/usb/musb-new/omap2430.c). Convert
them all to the C99 form so the tree is consistent and new patches
in these areas do not have to follow an outdated local style.

Ten "Unnecessary ftrace-like logging - prefer using ftrace" warnings
remain on the printf("%s\n", __func__) and dbg("%s\n", __func__)
function-entry traces in drivers/net/rtl8169.c (behind DEBUG_RTL8169*
preprocessor guards) and drivers/usb/host/ohci-hcd.c. checkpatch
matches the literal "%s\n", __func__ shape regardless of the wrapper,
so silencing those warnings would require changing the debug message
text or removing the traces entirely.

Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Aristo Chen
2026-06-10 14:49:46 -06:00
committed by Tom Rini
parent 1cc0442ede
commit 6c636eabbd
20 changed files with 57 additions and 57 deletions
+5 -5
View File
@@ -99,16 +99,16 @@ static void kw_sysrst_action(void)
if (!s) {
debug("Error.. %s failed, check sysrstcmd\n",
__FUNCTION__);
__func__);
return;
}
debug("Starting %s process...\n", __FUNCTION__);
debug("Starting %s process...\n", __func__);
ret = run_command(s, 0);
if (ret != 0)
debug("Error.. %s failed\n", __FUNCTION__);
debug("Error.. %s failed\n", __func__);
else
debug("%s process finished\n", __FUNCTION__);
debug("%s process finished\n", __func__);
}
static void kw_sysrst_check(void)
@@ -152,7 +152,7 @@ int print_cpuinfo(void)
u8 revid = readl(KW_REG_PCIE_REVID) & 0xff;
if ((readl(KW_REG_DEVICE_ID) & 0x03) > 2) {
printf("Error.. %s:Unsupported Kirkwood SoC 88F%04x\n", __FUNCTION__, devid);
printf("Error.. %s:Unsupported Kirkwood SoC 88F%04x\n", __func__, devid);
return -1;
}
+2 -2
View File
@@ -259,9 +259,9 @@ extern void __die_if_kernel(const char *, struct pt_regs *, const char *where,
unsigned long line);
#define die(msg, regs) \
__die(msg, regs, __FILE__ ":"__FUNCTION__, __LINE__)
__die(msg, regs, __FILE__ ":" __func__, __LINE__)
#define die_if_kernel(msg, regs) \
__die_if_kernel(msg, regs, __FILE__ ":"__FUNCTION__, __LINE__)
__die_if_kernel(msg, regs, __FILE__ ":" __func__, __LINE__)
static inline void execution_hazard_barrier(void)
{
+1 -1
View File
@@ -110,7 +110,7 @@ static void setup_fman_liodn_base(enum fsl_dpaa_dev dev,
break;
#endif
default:
printf("Error: Invalid device type to %s\n", __FUNCTION__);
printf("Error: Invalid device type to %s\n", __func__);
return;
}
+1 -1
View File
@@ -111,7 +111,7 @@ void mv_phy_88e1121_init(char *name)
/* command to read PHY dev address */
if (miiphy_read(name, 0xEE, 0xEE, (u16 *) &devadr)) {
printf("Err..%s could not read PHY dev address\n",
__FUNCTION__);
__func__);
return;
}
+1 -1
View File
@@ -135,7 +135,7 @@ static void sc_nand_hwcontrol(struct mtd_info *mtdinfo, int cmd, unsigned int ct
break;
default:
printf("%s: unknown ctrl %#x\n", __FUNCTION__, ctrl);
printf("%s: unknown ctrl %#x\n", __func__, ctrl);
}
if (ctrl & NAND_NCE)
+7 -7
View File
@@ -545,13 +545,13 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
if (banks > MEMORY_BANKS_MAX) {
printf("%s: num banks %d exceeds hardcoded limit %d."
" Recompile with higher MEMORY_BANKS_MAX?\n",
__FUNCTION__, banks, MEMORY_BANKS_MAX);
__func__, banks, MEMORY_BANKS_MAX);
return -1;
}
err = fdt_check_header(blob);
if (err < 0) {
printf("%s: %s\n", __FUNCTION__, fdt_strerror(err));
printf("%s: %s\n", __func__, fdt_strerror(err));
return err;
}
@@ -1497,7 +1497,7 @@ static u64 __of_translate_address(const void *blob, int node_offset,
/* Cound address cells & copy address locally */
bus->count_cells(blob, parent, &na, &ns);
if (!OF_CHECK_COUNTS(na, ns)) {
printf("%s: Bad cell count for %s\n", __FUNCTION__,
printf("%s: Bad cell count for %s\n", __func__,
fdt_get_name(blob, node_offset, NULL));
goto bail;
}
@@ -1524,8 +1524,8 @@ static u64 __of_translate_address(const void *blob, int node_offset,
pbus = of_match_bus(blob, parent);
pbus->count_cells(blob, parent, &pna, &pns);
if (!OF_CHECK_COUNTS(pna, pns)) {
printf("%s: Bad cell count for %s\n", __FUNCTION__,
fdt_get_name(blob, node_offset, NULL));
printf("%s: Bad cell count for %s\n", __func__,
fdt_get_name(blob, node_offset, NULL));
break;
}
@@ -1612,7 +1612,7 @@ int fdt_get_dma_range(const void *blob, int node, phys_addr_t *cpu,
bus_node = of_match_bus(blob, node);
bus_node->count_cells(blob, node, &na, &ns);
if (!OF_CHECK_COUNTS(na, ns)) {
printf("%s: Bad cell count for %s\n", __FUNCTION__,
printf("%s: Bad cell count for %s\n", __func__,
fdt_get_name(blob, node, NULL));
return -EINVAL;
goto out;
@@ -1621,7 +1621,7 @@ int fdt_get_dma_range(const void *blob, int node, phys_addr_t *cpu,
bus_node = of_match_bus(blob, parent);
bus_node->count_cells(blob, parent, &pna, &pns);
if (!OF_CHECK_COUNTS(pna, pns)) {
printf("%s: Bad cell count for %s\n", __FUNCTION__,
printf("%s: Bad cell count for %s\n", __func__,
fdt_get_name(blob, parent, NULL));
return -EINVAL;
goto out;
+1 -1
View File
@@ -221,7 +221,7 @@ void fsl_ddr_get_spd(generic_spd_eeprom_t *ctrl_dimms_spd,
unsigned int i2c_address = 0;
if (ctrl_num >= CONFIG_SYS_NUM_DDR_CTLRS) {
printf("%s unexpected ctrl_num = %u\n", __FUNCTION__, ctrl_num);
printf("%s unexpected ctrl_num = %u\n", __func__, ctrl_num);
return;
}
+1 -1
View File
@@ -21,7 +21,7 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
(struct ccsr_ddr __iomem *)CFG_SYS_FSL_DDR_ADDR;
if (ctrl_num != 0) {
printf("%s unexpected ctrl_num = %u\n", __FUNCTION__, ctrl_num);
printf("%s unexpected ctrl_num = %u\n", __func__, ctrl_num);
return;
}
+1 -1
View File
@@ -26,7 +26,7 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
#endif
if (ctrl_num) {
printf("%s unexpected ctrl_num = %u\n", __FUNCTION__, ctrl_num);
printf("%s unexpected ctrl_num = %u\n", __func__, ctrl_num);
return;
}
+1 -1
View File
@@ -71,7 +71,7 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
break;
#endif
default:
printf("%s unexpected ctrl_num = %u\n", __FUNCTION__, ctrl_num);
printf("%s unexpected ctrl_num = %u\n", __func__, ctrl_num);
return;
}
+6 -6
View File
@@ -52,7 +52,7 @@ static int spartan2_load(xilinx_desc *desc, const void *buf, size_t bsize,
default:
printf ("%s: Unsupported interface type, %d\n",
__FUNCTION__, desc->iface);
__func__, desc->iface);
}
return ret_val;
@@ -75,7 +75,7 @@ static int spartan2_dump(xilinx_desc *desc, const void *buf, size_t bsize)
default:
printf ("%s: Unsupported interface type, %d\n",
__FUNCTION__, desc->iface);
__func__, desc->iface);
}
return ret_val;
@@ -234,7 +234,7 @@ static int spartan2_sp_load(xilinx_desc *desc, const void *buf, size_t bsize)
#endif
} else {
printf ("%s: NULL Interface function table!\n", __FUNCTION__);
printf("%s: NULL Interface function table!\n", __func__);
}
return ret_val;
@@ -279,7 +279,7 @@ static int spartan2_sp_dump(xilinx_desc *desc, const void *buf, size_t bsize)
/* XXX - checksum the data? */
} else {
printf ("%s: NULL Interface function table!\n", __FUNCTION__);
printf("%s: NULL Interface function table!\n", __func__);
}
return ret_val;
@@ -423,7 +423,7 @@ static int spartan2_ss_load(xilinx_desc *desc, const void *buf, size_t bsize)
#endif
} else {
printf ("%s: NULL Interface function table!\n", __FUNCTION__);
printf("%s: NULL Interface function table!\n", __func__);
}
return ret_val;
@@ -434,7 +434,7 @@ static int spartan2_ss_dump(xilinx_desc *desc, const void *buf, size_t bsize)
/* Readback is only available through the Slave Parallel and */
/* boundary-scan interfaces. */
printf ("%s: Slave Serial Dumping is unavailable\n",
__FUNCTION__);
__func__);
return FPGA_FAIL;
}
+6 -6
View File
@@ -57,7 +57,7 @@ static int spartan3_load(xilinx_desc *desc, const void *buf, size_t bsize,
default:
printf ("%s: Unsupported interface type, %d\n",
__FUNCTION__, desc->iface);
__func__, desc->iface);
}
return ret_val;
@@ -80,7 +80,7 @@ static int spartan3_dump(xilinx_desc *desc, const void *buf, size_t bsize)
default:
printf ("%s: Unsupported interface type, %d\n",
__FUNCTION__, desc->iface);
__func__, desc->iface);
}
return ret_val;
@@ -241,7 +241,7 @@ static int spartan3_sp_load(xilinx_desc *desc, const void *buf, size_t bsize)
#endif
} else {
printf ("%s: NULL Interface function table!\n", __FUNCTION__);
printf("%s: NULL Interface function table!\n", __func__);
}
return ret_val;
@@ -286,7 +286,7 @@ static int spartan3_sp_dump(xilinx_desc *desc, const void *buf, size_t bsize)
/* XXX - checksum the data? */
} else {
printf ("%s: NULL Interface function table!\n", __FUNCTION__);
printf("%s: NULL Interface function table!\n", __func__);
}
return ret_val;
@@ -442,7 +442,7 @@ static int spartan3_ss_load(xilinx_desc *desc, const void *buf, size_t bsize)
#endif
} else {
printf ("%s: NULL Interface function table!\n", __FUNCTION__);
printf("%s: NULL Interface function table!\n", __func__);
}
return ret_val;
@@ -453,7 +453,7 @@ static int spartan3_ss_dump(xilinx_desc *desc, const void *buf, size_t bsize)
/* Readback is only available through the Slave Parallel and */
/* boundary-scan interfaces. */
printf ("%s: Slave Serial Dumping is unavailable\n",
__FUNCTION__);
__func__);
return FPGA_FAIL;
}
+6 -6
View File
@@ -149,8 +149,8 @@ int fpga_loadbitstream(int devnum, char *fpgadata, size_t size,
int xilinx_load(xilinx_desc *desc, const void *buf, size_t bsize,
bitstream_type bstype, int flags)
{
if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
printf ("%s: Invalid device descriptor\n", __FUNCTION__);
if (!xilinx_validate(desc, (char *)__func__)) {
printf("%s: Invalid device descriptor\n", __func__);
return FPGA_FAIL;
}
@@ -200,8 +200,8 @@ int xilinx_loads(xilinx_desc *desc, const void *buf, size_t bsize,
int xilinx_dump(xilinx_desc *desc, const void *buf, size_t bsize)
{
if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
printf ("%s: Invalid device descriptor\n", __FUNCTION__);
if (!xilinx_validate(desc, (char *)__func__)) {
printf("%s: Invalid device descriptor\n", __func__);
return FPGA_FAIL;
}
@@ -217,7 +217,7 @@ int xilinx_info(xilinx_desc *desc)
{
int ret_val = FPGA_FAIL;
if (xilinx_validate (desc, (char *)__FUNCTION__)) {
if (xilinx_validate(desc, (char *)__func__)) {
printf ("Family: \t");
switch (desc->family) {
case xilinx_spartan2:
@@ -293,7 +293,7 @@ int xilinx_info(xilinx_desc *desc)
ret_val = FPGA_SUCCESS;
} else {
printf ("%s: Invalid device descriptor\n", __FUNCTION__);
printf("%s: Invalid device descriptor\n", __func__);
}
return ret_val;
+1 -1
View File
@@ -112,7 +112,7 @@ uint mii_send(uint mii_cmd)
ep->eir = FEC_EIR_MII; /* clear MII complete */
#ifdef ET_DEBUG
printf("%s[%d] %s: sent=0x%8.8x, reply=0x%8.8x\n",
__FILE__, __LINE__, __FUNCTION__, mii_cmd, mii_reply);
__FILE__, __LINE__, __func__, mii_cmd, mii_reply);
#endif
return (mii_reply & 0xffff); /* data read from phy */
+9 -9
View File
@@ -404,7 +404,7 @@ static int rtl8169_init_board(unsigned long dev_iobase, const char *name)
u32 tmp;
#ifdef DEBUG_RTL8169
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
#endif
ioaddr = dev_iobase;
@@ -534,7 +534,7 @@ static int rtl_recv_common(struct udevice *dev, unsigned long dev_iobase,
int length = 0;
#ifdef DEBUG_RTL8169_RX
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
#endif
ioaddr = dev_iobase;
@@ -608,7 +608,7 @@ static int rtl_send_common(struct udevice *dev, unsigned long dev_iobase,
#ifdef DEBUG_RTL8169_TX
int stime = currticks();
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
printf("sending %d bytes\n", len);
#endif
@@ -679,7 +679,7 @@ static void rtl8169_set_rx_mode(void)
u32 tmp = 0;
#ifdef DEBUG_RTL8169
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
#endif
/* IFF_ALLMULTI */
@@ -701,7 +701,7 @@ static void rtl8169_hw_start(struct udevice *dev)
#ifdef DEBUG_RTL8169
int stime = currticks();
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
#endif
#if 0
@@ -771,7 +771,7 @@ static void rtl8169_init_ring(struct udevice *dev)
#ifdef DEBUG_RTL8169
int stime = currticks();
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
#endif
tpc->cur_rx = 0;
@@ -810,7 +810,7 @@ static void rtl8169_common_start(struct udevice *dev, unsigned char *enetaddr,
#ifdef DEBUG_RTL8169
int stime = currticks();
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
#endif
ioaddr = dev_iobase;
@@ -851,7 +851,7 @@ static void rtl_halt_common(struct udevice *dev)
int i;
#ifdef DEBUG_RTL8169
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
#endif
ioaddr = priv->iobase;
@@ -906,7 +906,7 @@ static int rtl_init(unsigned long dev_ioaddr, const char *name,
int option = -1, Cap10_100 = 0, Cap1000 = 0;
#ifdef DEBUG_RTL8169
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
#endif
ioaddr = dev_ioaddr;
+2 -2
View File
@@ -66,7 +66,7 @@ static void m41t62_update_rtc_time(struct rtc_time *tm, u8 *buf)
{
debug("%s: raw read data - sec=%02x, min=%02x, hr=%02x, "
"mday=%02x, mon=%02x, year=%02x, wday=%02x, y2k=%02x\n",
__FUNCTION__,
__func__,
buf[0], buf[1], buf[2], buf[3],
buf[4], buf[5], buf[6], buf[7]);
@@ -83,7 +83,7 @@ static void m41t62_update_rtc_time(struct rtc_time *tm, u8 *buf)
debug("%s: tm is secs=%d, mins=%d, hours=%d, "
"mday=%d, mon=%d, year=%d, wday=%d\n",
__FUNCTION__,
__func__,
tm->tm_sec, tm->tm_min, tm->tm_hour,
tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);
}
+1 -1
View File
@@ -1750,7 +1750,7 @@ static int hc_reset(ohci_t *ohci)
int timeout = 30;
int smm_timeout = 50; /* 0,5 sec */
dbg("%s\n", __FUNCTION__);
dbg("%s\n", __func__);
#ifdef CONFIG_PCI_EHCI_DEVNO
/*
+1 -1
View File
@@ -100,7 +100,7 @@ static int omap2430_musb_enable(struct musb *musb)
#ifdef CONFIG_TWL4030_USB
if (twl4030_usb_ulpi_init()) {
serial_printf("ERROR: %s Could not initialize PHY\n",
__PRETTY_FUNCTION__);
__func__);
}
#endif
return 0;
+1 -1
View File
@@ -58,7 +58,7 @@ static uchar dbg = 0;
#define PDEBUG(fmt, args...) { \
if(dbg != 0) { \
printf("[%s %d %s]: ",__FILE__,__LINE__,__FUNCTION__);\
printf("[%s %d %s]: ", __FILE__, __LINE__, __func__);\
printf(fmt, ##args); \
printf("\n"); \
} \
+3 -3
View File
@@ -22,19 +22,19 @@
#define MAX_URBS_QUEUED 5
#if 1
#define usberr(fmt,args...) serial_printf("ERROR: %s(), %d: "fmt"\n",__FUNCTION__,__LINE__,##args)
#define usberr(fmt, args...) serial_printf("ERROR: %s(), %d: " fmt "\n", __func__, __LINE__, ##args)
#else
#define usberr(fmt,args...) do{}while(0)
#endif
#if 0
#define usbdbg(fmt,args...) serial_printf("debug: %s(), %d: "fmt"\n",__FUNCTION__,__LINE__,##args)
#define usbdbg(fmt, args...) serial_printf("debug: %s(), %d: " fmt "\n", __func__, __LINE__, ##args)
#else
#define usbdbg(fmt,args...) do{}while(0)
#endif
#if 0
#define usbinfo(fmt,args...) serial_printf("info: %s(), %d: "fmt"\n",__FUNCTION__,__LINE__,##args)
#define usbinfo(fmt, args...) serial_printf("info: %s(), %d: " fmt "\n", __func__, __LINE__, ##args)
#else
#define usbinfo(fmt,args...) do{}while(0)
#endif