From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,T_DKIMWL_WL_HIGH,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F812C28CC3 for ; Fri, 7 Jun 2019 08:55:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 41B8D208E3 for ; Fri, 7 Jun 2019 08:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559897757; bh=IvLBKDDfH1X/y3ASBeZRvI4TAvNfCDmw2ao7jli1B7w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=ajlfqcMc+zWo8OjugegurlB2qMqvNElH/FihHrX05bfHCweeb7+6RB1v0cGosTe/F ljWz4qC6wgknAHQs9DAVTPOv5BorrpFA/6gpzGJao3LH3JecPQAOYeYFmYAb5s4e0K infsTk44fV8s63Ffm4AQuC8Iou5BBH5zRjDon3qg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726923AbfFGIz5 (ORCPT ); Fri, 7 Jun 2019 04:55:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:56260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726531AbfFGIz4 (ORCPT ); Fri, 7 Jun 2019 04:55:56 -0400 Received: from localhost.localdomain (nat-pool-mxp-t.redhat.com [149.6.153.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 04FA72089E; Fri, 7 Jun 2019 08:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559897755; bh=IvLBKDDfH1X/y3ASBeZRvI4TAvNfCDmw2ao7jli1B7w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=zhn8tDa0ybWFaAlS0j7qUq/xbRZ4TcBL1DkFmNKG8NliNlR4OL3MY6ieDDFJV7X/s LWf3c0zZMojJqASffujo6NFuMK1E9cde2quCPuiumBNUHmeGDKifUiqonGtgF17ykQ VTF7Cpu6tLhYsUI3bZBzyo4ung4ei8iFl8dwLGis= Date: Fri, 7 Jun 2019 10:55:50 +0200 From: Lorenzo Bianconi To: jic23@kernel.org Cc: linux-iio@vger.kernel.org, lorenzo.bianconi@redhat.com, Vitor.Soares@synopsys.com, boris.brezillon@collabora.com Subject: Re: [PATCH] iio: imu: st_lsm6dsx: get device name from st_lsm6dsx_dev_name Message-ID: <20190607085548.GA10501@localhost.localdomain> References: <2531966256f991d802a775d953656b92ae8216bd.1559862531.git.lorenzo@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fdj2RfSjLxBAspz7" Content-Disposition: inline In-Reply-To: <2531966256f991d802a775d953656b92ae8216bd.1559862531.git.lorenzo@kernel.org> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org --fdj2RfSjLxBAspz7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > Introduce st_lsm6dsx_dev_name lookup table to get device name. This is > a preliminary patch to add I3C support to st_lsm6dsx since i3c_device_id > data structure does not contain a name field >=20 Hi Jonathan, please hold on with this patch, I will post a v2 moving device name in st_lsm6dsx_settings Regards, Lorenzo > Signed-off-by: Lorenzo Bianconi > --- > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 2 +- > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 16 +++++++++++++++- > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c | 3 +-- > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c | 3 +-- > 4 files changed, 18 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st= _lsm6dsx/st_lsm6dsx.h > index 004a8a1a0027..71627206fc30 100644 > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h > @@ -302,7 +302,7 @@ struct st_lsm6dsx_hw { > static const unsigned long st_lsm6dsx_available_scan_masks[] =3D {0x7, 0= x0}; > extern const struct dev_pm_ops st_lsm6dsx_pm_ops; > =20 > -int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, const char = *name, > +int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, > struct regmap *regmap); > int st_lsm6dsx_sensor_set_enable(struct st_lsm6dsx_sensor *sensor, > bool enable); > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/i= mu/st_lsm6dsx/st_lsm6dsx_core.c > index cf82c9049945..339b75040732 100644 > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > @@ -70,6 +70,18 @@ > #define ST_LSM6DSX_REG_GYRO_OUT_Y_L_ADDR 0x24 > #define ST_LSM6DSX_REG_GYRO_OUT_Z_L_ADDR 0x26 > =20 > +static const char st_lsm6dsx_dev_name[][32] =3D { > + [ST_LSM6DS3_ID] =3D ST_LSM6DS3_DEV_NAME, > + [ST_LSM6DS3H_ID] =3D ST_LSM6DS3H_DEV_NAME, > + [ST_LSM6DSL_ID] =3D ST_LSM6DSL_DEV_NAME, > + [ST_LSM6DSM_ID] =3D ST_LSM6DSM_DEV_NAME, > + [ST_ISM330DLC_ID] =3D ST_ISM330DLC_DEV_NAME, > + [ST_LSM6DSO_ID] =3D ST_LSM6DSO_DEV_NAME, > + [ST_ASM330LHH_ID] =3D ST_ASM330LHH_DEV_NAME, > + [ST_LSM6DSOX_ID] =3D ST_LSM6DSOX_DEV_NAME, > + [ST_LSM6DSR_ID] =3D ST_LSM6DSR_DEV_NAME, > +}; > + > static const struct st_lsm6dsx_odr_table_entry st_lsm6dsx_odr_table[] = =3D { > [ST_LSM6DSX_ID_ACC] =3D { > .reg =3D { > @@ -1041,11 +1053,12 @@ static struct iio_dev *st_lsm6dsx_alloc_iiodev(st= ruct st_lsm6dsx_hw *hw, > return iio_dev; > } > =20 > -int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, const char = *name, > +int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, > struct regmap *regmap) > { > const struct st_lsm6dsx_shub_settings *hub_settings; > struct st_lsm6dsx_hw *hw; > + const char *name; > int i, err; > =20 > hw =3D devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL); > @@ -1070,6 +1083,7 @@ int st_lsm6dsx_probe(struct device *dev, int irq, i= nt hw_id, const char *name, > if (err < 0) > return err; > =20 > + name =3D st_lsm6dsx_dev_name[hw_id]; > for (i =3D 0; i < ST_LSM6DSX_ID_EXT0; i++) { > hw->iio_devs[i] =3D st_lsm6dsx_alloc_iiodev(hw, i, name); > if (!hw->iio_devs[i]) > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c b/drivers/iio/im= u/st_lsm6dsx/st_lsm6dsx_i2c.c > index f54370196098..47581a4e456e 100644 > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c > @@ -36,8 +36,7 @@ static int st_lsm6dsx_i2c_probe(struct i2c_client *clie= nt, > return PTR_ERR(regmap); > } > =20 > - return st_lsm6dsx_probe(&client->dev, client->irq, > - hw_id, id->name, regmap); > + return st_lsm6dsx_probe(&client->dev, client->irq, hw_id, regmap); > } > =20 > static const struct of_device_id st_lsm6dsx_i2c_of_match[] =3D { > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c b/drivers/iio/im= u/st_lsm6dsx/st_lsm6dsx_spi.c > index 4a4abb2935da..facf66978a4b 100644 > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c > @@ -36,8 +36,7 @@ static int st_lsm6dsx_spi_probe(struct spi_device *spi) > return PTR_ERR(regmap); > } > =20 > - return st_lsm6dsx_probe(&spi->dev, spi->irq, > - hw_id, id->name, regmap); > + return st_lsm6dsx_probe(&spi->dev, spi->irq, hw_id, regmap); > } > =20 > static const struct of_device_id st_lsm6dsx_spi_of_match[] =3D { > --=20 > 2.21.0 >=20 --fdj2RfSjLxBAspz7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCXPomkgAKCRA6cBh0uS2t rJqpAQCtTZmeQmRO8kqjpJ90nJJRJ0OCcPYeoLbq/bGgDZGUmAEAkiBqMlRz7ee4 J2A4ionuXY+YWXHROwsl2fXEjUd0iAE= =XlO5 -----END PGP SIGNATURE----- --fdj2RfSjLxBAspz7--