@@ -1317,30 +1317,34 @@ struct device_link *device_link_add(struct device *consumer,
1317
1317
struct device * supplier , u32 flags );
1318
1318
void device_link_del (struct device_link * link );
1319
1319
1320
+ #ifndef dev_fmt
1321
+ #define dev_fmt (fmt ) fmt
1322
+ #endif
1323
+
1320
1324
#ifdef CONFIG_PRINTK
1321
1325
1322
- extern __printf (3 , 0 )
1326
+ __printf (3 , 0 )
1323
1327
int dev_vprintk_emit (int level , const struct device * dev ,
1324
1328
const char * fmt , va_list args );
1325
- extern __printf (3 , 4 )
1329
+ __printf (3 , 4 )
1326
1330
int dev_printk_emit (int level , const struct device * dev , const char * fmt , ...);
1327
1331
1328
- extern __printf (3 , 4 )
1332
+ __printf (3 , 4 )
1329
1333
void dev_printk (const char * level , const struct device * dev ,
1330
1334
const char * fmt , ...);
1331
- extern __printf (2 , 3 )
1332
- void dev_emerg (const struct device * dev , const char * fmt , ...);
1333
- extern __printf (2 , 3 )
1334
- void dev_alert (const struct device * dev , const char * fmt , ...);
1335
- extern __printf (2 , 3 )
1336
- void dev_crit (const struct device * dev , const char * fmt , ...);
1337
- extern __printf (2 , 3 )
1338
- void dev_err (const struct device * dev , const char * fmt , ...);
1339
- extern __printf (2 , 3 )
1340
- void dev_warn (const struct device * dev , const char * fmt , ...);
1341
- extern __printf (2 , 3 )
1342
- void dev_notice (const struct device * dev , const char * fmt , ...);
1343
- extern __printf (2 , 3 )
1335
+ __printf (2 , 3 )
1336
+ void _dev_emerg (const struct device * dev , const char * fmt , ...);
1337
+ __printf (2 , 3 )
1338
+ void _dev_alert (const struct device * dev , const char * fmt , ...);
1339
+ __printf (2 , 3 )
1340
+ void _dev_crit (const struct device * dev , const char * fmt , ...);
1341
+ __printf (2 , 3 )
1342
+ void _dev_err (const struct device * dev , const char * fmt , ...);
1343
+ __printf (2 , 3 )
1344
+ void _dev_warn (const struct device * dev , const char * fmt , ...);
1345
+ __printf (2 , 3 )
1346
+ void _dev_notice (const struct device * dev , const char * fmt , ...);
1347
+ __printf (2 , 3 )
1344
1348
void _dev_info (const struct device * dev , const char * fmt , ...);
1345
1349
1346
1350
#else
@@ -1358,26 +1362,26 @@ static inline void __dev_printk(const char *level, const struct device *dev,
1358
1362
{}
1359
1363
static inline __printf (3 , 4 )
1360
1364
void dev_printk (const char * level , const struct device * dev ,
1361
- const char * fmt , ...)
1365
+ const char * fmt , ...)
1362
1366
{}
1363
1367
1364
1368
static inline __printf (2 , 3 )
1365
- void dev_emerg (const struct device * dev , const char * fmt , ...)
1369
+ void _dev_emerg (const struct device * dev , const char * fmt , ...)
1366
1370
{}
1367
1371
static inline __printf (2 , 3 )
1368
- void dev_crit (const struct device * dev , const char * fmt , ...)
1372
+ void _dev_crit (const struct device * dev , const char * fmt , ...)
1369
1373
{}
1370
1374
static inline __printf (2 , 3 )
1371
- void dev_alert (const struct device * dev , const char * fmt , ...)
1375
+ void _dev_alert (const struct device * dev , const char * fmt , ...)
1372
1376
{}
1373
1377
static inline __printf (2 , 3 )
1374
- void dev_err (const struct device * dev , const char * fmt , ...)
1378
+ void _dev_err (const struct device * dev , const char * fmt , ...)
1375
1379
{}
1376
1380
static inline __printf (2 , 3 )
1377
- void dev_warn (const struct device * dev , const char * fmt , ...)
1381
+ void _dev_warn (const struct device * dev , const char * fmt , ...)
1378
1382
{}
1379
1383
static inline __printf (2 , 3 )
1380
- void dev_notice (const struct device * dev , const char * fmt , ...)
1384
+ void _dev_notice (const struct device * dev , const char * fmt , ...)
1381
1385
{}
1382
1386
static inline __printf (2 , 3 )
1383
1387
void _dev_info (const struct device * dev , const char * fmt , ...)
@@ -1386,27 +1390,36 @@ void _dev_info(const struct device *dev, const char *fmt, ...)
1386
1390
#endif
1387
1391
1388
1392
/*
1389
- * Stupid hackaround for existing uses of non-printk uses dev_info
1390
- *
1391
- * Note that the definition of dev_info below is actually _dev_info
1392
- * and a macro is used to avoid redefining dev_info
1393
+ * #defines for all the dev_<level> macros to prefix with whatever
1394
+ * possible use of #define dev_fmt(fmt) ...
1393
1395
*/
1394
1396
1395
- #define dev_info (dev , fmt , arg ...) _dev_info (dev , fmt , ##arg )
1397
+ #define dev_emerg (dev , fmt , ...) \
1398
+ _dev_emerg(dev, dev_fmt(fmt), ##__VA_ARGS__)
1399
+ #define dev_crit (dev , fmt , ...) \
1400
+ _dev_crit(dev, dev_fmt(fmt), ##__VA_ARGS__)
1401
+ #define dev_alert (dev , fmt , ...) \
1402
+ _dev_alert(dev, dev_fmt(fmt), ##__VA_ARGS__)
1403
+ #define dev_err (dev , fmt , ...) \
1404
+ _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
1405
+ #define dev_warn (dev , fmt , ...) \
1406
+ _dev_warn(dev, dev_fmt(fmt), ##__VA_ARGS__)
1407
+ #define dev_notice (dev , fmt , ...) \
1408
+ _dev_notice(dev, dev_fmt(fmt), ##__VA_ARGS__)
1409
+ #define dev_info (dev , fmt , ...) \
1410
+ _dev_info(dev, dev_fmt(fmt), ##__VA_ARGS__)
1396
1411
1397
1412
#if defined(CONFIG_DYNAMIC_DEBUG )
1398
- #define dev_dbg (dev , format , ...) \
1399
- do { \
1400
- dynamic_dev_dbg (dev , format , ##__VA_ARGS__ ); \
1401
- } while (0 )
1413
+ #define dev_dbg (dev , fmt , ...) \
1414
+ dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
1402
1415
#elif defined(DEBUG )
1403
- #define dev_dbg (dev , format , arg ...) \
1404
- dev_printk (KERN_DEBUG , dev , format , ##arg )
1416
+ #define dev_dbg (dev , fmt , ...) \
1417
+ dev_printk(KERN_DEBUG, dev, dev_fmt(fmt) , ##__VA_ARGS__ )
1405
1418
#else
1406
- #define dev_dbg (dev , format , arg ...) \
1407
- ({ \
1408
- if (0 ) \
1409
- dev_printk (KERN_DEBUG , dev , format , ##arg ); \
1419
+ #define dev_dbg (dev , fmt , ...) \
1420
+ ({ \
1421
+ if (0) \
1422
+ dev_printk(KERN_DEBUG, dev, dev_fmt(fmt) , ##__VA_ARGS__); \
1410
1423
})
1411
1424
#endif
1412
1425
@@ -1478,7 +1491,7 @@ do { \
1478
1491
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
1479
1492
if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
1480
1493
__ratelimit(&_rs)) \
1481
- __dynamic_dev_dbg(&descriptor, dev, fmt, \
1494
+ __dynamic_dev_dbg(&descriptor, dev, dev_fmt( fmt), \
1482
1495
##__VA_ARGS__); \
1483
1496
} while (0)
1484
1497
#elif defined(DEBUG )
@@ -1488,23 +1501,23 @@ do { \
1488
1501
DEFAULT_RATELIMIT_INTERVAL, \
1489
1502
DEFAULT_RATELIMIT_BURST); \
1490
1503
if (__ratelimit(&_rs)) \
1491
- dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
1504
+ dev_printk(KERN_DEBUG, dev, dev_fmt( fmt) , ##__VA_ARGS__); \
1492
1505
} while (0)
1493
1506
#else
1494
1507
#define dev_dbg_ratelimited (dev , fmt , ...) \
1495
1508
do { \
1496
1509
if (0) \
1497
- dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
1510
+ dev_printk(KERN_DEBUG, dev, dev_fmt( fmt) , ##__VA_ARGS__); \
1498
1511
} while (0)
1499
1512
#endif
1500
1513
1501
1514
#ifdef VERBOSE_DEBUG
1502
1515
#define dev_vdbg dev_dbg
1503
1516
#else
1504
- #define dev_vdbg (dev , format , arg ...) \
1505
- ({ \
1506
- if (0) \
1507
- dev_printk(KERN_DEBUG, dev, format , ##arg); \
1517
+ #define dev_vdbg (dev , fmt , ...) \
1518
+ ({ \
1519
+ if (0) \
1520
+ dev_printk(KERN_DEBUG, dev, dev_fmt(fmt) , ##__VA_ARGS__); \
1508
1521
})
1509
1522
#endif
1510
1523
0 commit comments