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]
Date:   Tue, 10 Mar 2020 18:24:10 +0530
From:   rishi gupta <gupt21@...il.com>
To:     Wolfram Sang <wsa@...-dreams.de>
Cc:     Jiri Kosina <jikos@...nel.org>,
        Benjamin Tissoires <benjamin.tissoires@...hat.com>,
        wsa+renesas@...g-engineering.com,
        Greg KH <gregkh@...uxfoundation.org>,
        Linux I2C <linux-i2c@...r.kernel.org>,
        "open list:HID CORE LAYER" <linux-input@...r.kernel.org>,
        lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] HID: mcp2221: add usb to i2c-smbus host bridge

I will send two more patches in sometime.

Patch 1: Define i2c_adapter_quirks to let i2c core check msg's order,
type and length
              As of now this driver itself is doing this sanity.

Patch 2: Add support for GPIO functionality

On Tue, Mar 10, 2020 at 5:59 PM Wolfram Sang <wsa@...-dreams.de> wrote:
>
>
> > +     if (num == 1) {
> > +             if (msgs->flags & I2C_M_RD) {
> > +                     ret = mcp_i2c_smbus_read(mcp, msgs, MCP2221_I2C_RD_DATA,
> > +                                                     0, 0, NULL);
> > +             } else {
> > +                     ret = mcp_i2c_write(mcp, msgs, MCP2221_I2C_WR_DATA, 1);
> > +             }
> > +             if (ret)
> > +                     goto exit;
> > +             ret = num;
> > +     } else if (num == 2) {
> > +             /* Ex transaction; send reg address and read its contents */
> > +             if (msgs[0].addr == msgs[1].addr &&
> > +                     !(msgs[0].flags & I2C_M_RD) &&
> > +                      (msgs[1].flags & I2C_M_RD)) {
> > +
> > +                     ret = mcp_i2c_write(mcp, &msgs[0],
> > +                                             MCP2221_I2C_WR_NO_STOP, 0);
> > +                     if (ret)
> > +                             goto exit;
> > +
> > +                     ret = mcp_i2c_smbus_read(mcp, &msgs[1],
> > +                                             MCP2221_I2C_RD_RPT_START,
> > +                                             0, 0, NULL);
> > +                     if (ret)
> > +                             goto exit;
> > +                     ret = num;
> > +             } else {
> > +                     dev_err(&adapter->dev,
> > +                             "unsupported multi-msg i2c transaction\n");
> > +                     ret = -EOPNOTSUPP;
> > +             }
> > +     } else {
> > +             dev_err(&adapter->dev,
> > +                     "unsupported multi-msg i2c transaction\n");
> > +             ret = -EOPNOTSUPP;
> > +     }
>
> Have a look at struct i2c_adapter_quirks and especially the flags to let
> the I2C core do the sanity checks from here.
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ