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] [day] [month] [year] [list]
Message-ID: <b0457b4a-2e0d-41e1-66fe-6fdb7a00f2db@google.com>
Date:   Mon, 19 Mar 2018 19:14:37 -0700
From:   Benson Leung <bleung@...gle.com>
To:     Dmitry Torokhov <dmitry.torokhov@...il.com>,
        linux-input@...r.kernel.org, Benson Leung <bleung@...omium.org>
Cc:     Nick Dyer <nick@...anahar.org>, Olof Johansson <olof@...om.net>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 07/14] platform/chrome: chromeos_laptop - factor out
 getting IRQ from DMI



On 03/12/2018 12:09 PM, Dmitry Torokhov wrote:
> This will make code instantiating I2C device a bit clearer.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>

Applied to my working branch for atmel_mxt_ts + chromeos_laptop.c for
v4.17. Thanks!

> ---
>  drivers/platform/chrome/chromeos_laptop.c | 35 +++++++++++++++--------
>  1 file changed, 23 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c
> index 08ce7a105e768..96e962ff38e87 100644
> --- a/drivers/platform/chrome/chromeos_laptop.c
> +++ b/drivers/platform/chrome/chromeos_laptop.c
> @@ -120,36 +120,47 @@ static struct i2c_board_info atmel_1664s_device = {
>  	.flags		= I2C_CLIENT_WAKE,
>  };
>  
> +static int chromeos_laptop_get_irq_from_dmi(const char *dmi_name)
> +{
> +	const struct dmi_device *dmi_dev;
> +	const struct dmi_dev_onboard *dev_data;
> +
> +	dmi_dev = dmi_find_device(DMI_DEV_TYPE_DEV_ONBOARD, dmi_name, NULL);
> +	if (!dmi_dev) {
> +		pr_err("failed to find DMI device '%s'\n", dmi_name);
> +		return -ENOENT;
> +	}
> +
> +	dev_data = dmi_dev->device_data;
> +	if (!dev_data) {
> +		pr_err("failed to get data from DMI for '%s'\n", dmi_name);
> +		return -EINVAL;
> +	}
> +
> +	return dev_data->instance;
> +}
> +
>  static struct i2c_client *__add_probed_i2c_device(
>  		const char *name,
>  		int bus,
>  		struct i2c_board_info *info,
>  		const unsigned short *alt_addr_list)
>  {
> -	const struct dmi_device *dmi_dev;
> -	const struct dmi_dev_onboard *dev_data;
>  	struct i2c_adapter *adapter;
>  	struct i2c_client *client = NULL;
>  	const unsigned short addr_list[] = { info->addr, I2C_CLIENT_END };
>  
>  	if (bus < 0)
>  		return NULL;
> +
>  	/*
>  	 * If a name is specified, look for irq platform information stashed
>  	 * in DMI_DEV_TYPE_DEV_ONBOARD by the Chrome OS custom system firmware.
>  	 */
>  	if (name) {
> -		dmi_dev = dmi_find_device(DMI_DEV_TYPE_DEV_ONBOARD, name, NULL);
> -		if (!dmi_dev) {
> -			pr_err("failed to dmi find device %s\n", name);
> -			return NULL;
> -		}
> -		dev_data = (struct dmi_dev_onboard *)dmi_dev->device_data;
> -		if (!dev_data) {
> -			pr_err("failed to get data from dmi for %s\n", name);
> +		info->irq = chromeos_laptop_get_irq_from_dmi(name);
> +		if (info->irq < 0)
>  			return NULL;
> -		}
> -		info->irq = dev_data->instance;
>  	}
>  
>  	adapter = i2c_get_adapter(bus);
> 

-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@...gle.com
Chromium OS Project
bleung@...omium.org



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