Re: [PATCH v6 2/2] iio: proximity: Add driver support for vcnl3020 proximity sensor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 1, 2020 at 7:24 PM Ivan Mikhaylov <i.mikhaylov@xxxxxxxxx> wrote:
>
> Proximity sensor driver based on light/vcnl4000.c code.
> For now supports only the single on-demand measurement.
>
> The VCNL3020 is a fully integrated proximity sensor. Fully
> integrated means that the infrared emitter is included in the
> package. It has 16-bit resolution. It includes a signal
> processing IC and features standard I2C communication
> interface. It features an interrupt function.

Thank you for an update, my comments below.

...

> +static int get_and_apply_property(struct vcnl3020_data *data, const char *prop,
> +                                 u32 reg)
> +{
> +       int rc;
> +       u32 val;
> +
> +       rc = device_property_read_u32(data->dev, prop, &val);
> +       if (rc)
> +               return 0;
> +
> +       rc = regmap_write(data->regmap, reg, val);
> +       if (rc)

> +               dev_err(data->dev, "Error (%d) setting property (%s)",
> +                       rc, prop);

This requires {} according to the coding style.

> +       return rc;
> +}

...

> +static int vcnl3020_probe(struct i2c_client *client)
> +{

> +       indio_dev->name = VCNL_DRV_NAME;

It's definitely not a driver name. You have to put part number here.

> +}

...

> +static struct i2c_driver vcnl3020_driver = {
> +       .driver = {

> +               .name   = VCNL_DRV_NAME,

Better to spell it explicitly.

> +               .of_match_table = vcnl3020_of_match,
> +       },
> +       .probe_new  = vcnl3020_probe,
> +};

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux