lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 6 Apr 2021 21:54:14 +0200
From:   Wolfram Sang <wsa@...nel.org>
To:     Yicong Yang <yangyicong@...ilicon.com>
Cc:     andriy.shevchenko@...ux.intel.com, linux-i2c@...r.kernel.org,
        Sergey.Semin@...kalelectronics.ru, linux-kernel@...r.kernel.org,
        digetx@...il.com, treding@...dia.com,
        jarkko.nikula@...ux.intel.com, rmk+kernel@...linux.org.uk,
        song.bao.hua@...ilicon.com, john.garry@...wei.com,
        mika.westerberg@...ux.intel.com, prime.zeng@...wei.com,
        linuxarm@...wei.com
Subject: Re: [PATCH v6 2/5] i2c: core: add api to provide frequency mode
 strings


> diff --git a/include/linux/i2c.h b/include/linux/i2c.h
> index 10bd0b0..7268180 100644
> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -47,6 +47,26 @@ typedef int (*i2c_slave_cb_t)(struct i2c_client *client,
>  #define I2C_MAX_HIGH_SPEED_MODE_FREQ	3400000
>  #define I2C_MAX_ULTRA_FAST_MODE_FREQ	5000000
>  
> +static inline const char *i2c_freq_mode_string(u32 bus_freq_hz)
> +{
> +	switch (bus_freq_hz) {
> +	case I2C_MAX_STANDARD_MODE_FREQ:
> +		return "Standard Mode (100 kHz)";
> +	case I2C_MAX_FAST_MODE_FREQ:
> +		return "Fast Mode (400 kHz)";
> +	case I2C_MAX_FAST_MODE_PLUS_FREQ:
> +		return "Fast Mode Plus (1.0 MHz)";
> +	case I2C_MAX_TURBO_MODE_FREQ:
> +		return "Turbo Mode (1.4 MHz)";
> +	case I2C_MAX_HIGH_SPEED_MODE_FREQ:
> +		return "High Speed Mode (3.4 MHz)";
> +	case I2C_MAX_ULTRA_FAST_MODE_FREQ:
> +		return "Ultra Fast Mode (5.0 MHz)";
> +	default:
> +		return "Unknown Mode";
> +	}
> +}

Any reason ehy this is an inline function? My gut feeling says it would
be better added to the core?


Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ