[lkml]   [2006]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Tiny error in printk output for clocksource : a3:<6>Time: acpi_pm clocksource has been installed.
    On Thu, 2006-09-28 at 18:19 +0200, Denis Vlasenko wrote:
    > You are trying to cover all possible cases with this monstrosity:
    > extern char *__dev_addr6_fmt(char* buf, const unsigned char *addr);
    > #define DEV_ADDR6_FMT "%s" /* expands to: "FF:FF:FF:FF:FF:FF" */
    > #define DEV_ADDR6_BUF char __dev_addr6_buf[sizeof("FF:FF:FF:FF:FF:FF")]
    > DEV_ADDR6_BUF;
    > ...
    > printk(", h/w address " DEV_ADDR6_FMT "\n", DEV_ADDR6(dev->dev_addr));

    Yup, it's not pretty.

    > Why don't you use a parameter for DEV_ADDR6{_BUF}? DEV_ADDR6_BUF(var_name).
    > DEV_ADDR6(var_name, addr). That would be less cryptic.

    Your idea makes code a bit visually longer, but I've no real objection.

    > print_mac(", h/w address ", dev->dev_addr, "\n");

    > > Would a patch with a DEV6_ADDR->EUI48 substitution
    > > be acceptable?
    > Maybe. Doesn't look obvious, but if it is in standards...


    extern char *__EUI48_fmt(char *buf, const unsigned char *addr);
    #define EUI48_FMT "%s" /* expands to: "FF:FF:FF:FF:FF:FF" */
    #define DECLARE_EUI48(name) char name[sizeof("FF:FF:FF:FF:FF:FF")]
    #define EUI48(name, addr) __EUI48_fmt(name, (const unsigned char *)addr)

    use case:

    printk("mac: " EUI48_FMT, EUI48(eui48, dev->dev_addr));

    Here's one with an assumption of an eui48 buffer name.

    extern char *__EUI48_fmt(char *buf, const unsigned char *addr);
    #define EUI48_FMT "%s" /* expands to: "FF:FF:FF:FF:FF:FF" */
    #define DECLARE_EUI48 char __eui48_buf[sizeof("FF:FF:FF:FF:FF:FF")]
    #define EUI48(addr) __EUI48_fmt(__eui48_buf, (const unsigned char *)addr)

    use case:

    printk("mac: " EUI48_FMT, EUI48(dev->dev_addr));

    Which one do you like more?

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2006-09-28 19:05    [W:0.020 / U:1.584 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site