From: wsa@kernel.org <wsa@kernel.org>
To: linux-aspeed@lists.ozlabs.org
Subject: [PATCH v2 2/5] input: misc: Add IBM Operation Panel driver
Date: Tue, 8 Sep 2020 22:40:51 +0200 [thread overview]
Message-ID: <20200908204051.GA46393@kunai> (raw)
In-Reply-To: <20200908200101.64974-3-eajames@linux.ibm.com>
Hi Eddie,
> + switch (event) {
> + case I2C_SLAVE_STOP:
> + command_size = panel->idx;
> + fallthrough;
> + case I2C_SLAVE_WRITE_REQUESTED:
> + panel->idx = 0;
> + break;
> + case I2C_SLAVE_WRITE_RECEIVED:
> + if (panel->idx < sizeof(panel->command))
> + panel->command[panel->idx++] = *val;
> + else
> + /*
> + * The command is too long and therefore invalid, so set the index
> + * to it's largest possible value. When a STOP is finally received,
> + * the command will be rejected upon processing.
> + */
> + panel->idx = U8_MAX;
> + break;
> + default:
> + break;
> + }
Sorry, I missed this in my last review. READ states are mandatory, so
you will need something like this:
+ case I2C_SLAVE_READ_REQUESTED:
+ case I2C_SLAVE_READ_PROCESSED:
+ *val = 0xff;
+ break;
> + if (command_size)
> + ibm_panel_process_command(panel, command_size);
I wondered if you could check for the correct command_size here, so no
need to call into the function when the size doesn't match?
> + rc = i2c_slave_register(client, ibm_panel_i2c_slave_cb);
> + if (rc) {
> + input_unregister_device(panel->input);
> + dev_err(&client->dev,
> + "Failed to register I2C slave device: %d\n", rc);
This dev_err can go. The core will print messages if something goes
wrong.
The rest looks good from an I2C point of view.
I'd think this all should go via the input tree?
Kind regards,
Wolfram
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linux-aspeed/attachments/20200908/a04ca8c7/attachment.sig>
WARNING: multiple messages have this Message-ID (diff)
From: wsa@kernel.org
To: Eddie James <eajames@linux.ibm.com>
Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-aspeed@lists.ozlabs.org,
linux-i2c@vger.kernel.org, joel@jms.id.au, andrew@aj.id.au,
benh@kernel.crashing.org, brendanhiggins@google.com,
dmitry.torokhov@gmail.com, robh+dt@kernel.org,
rentao.bupt@gmail.com, ryan_chen@aspeedtech.com
Subject: Re: [PATCH v2 2/5] input: misc: Add IBM Operation Panel driver
Date: Tue, 8 Sep 2020 22:40:51 +0200 [thread overview]
Message-ID: <20200908204051.GA46393@kunai> (raw)
In-Reply-To: <20200908200101.64974-3-eajames@linux.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1472 bytes --]
Hi Eddie,
> + switch (event) {
> + case I2C_SLAVE_STOP:
> + command_size = panel->idx;
> + fallthrough;
> + case I2C_SLAVE_WRITE_REQUESTED:
> + panel->idx = 0;
> + break;
> + case I2C_SLAVE_WRITE_RECEIVED:
> + if (panel->idx < sizeof(panel->command))
> + panel->command[panel->idx++] = *val;
> + else
> + /*
> + * The command is too long and therefore invalid, so set the index
> + * to it's largest possible value. When a STOP is finally received,
> + * the command will be rejected upon processing.
> + */
> + panel->idx = U8_MAX;
> + break;
> + default:
> + break;
> + }
Sorry, I missed this in my last review. READ states are mandatory, so
you will need something like this:
+ case I2C_SLAVE_READ_REQUESTED:
+ case I2C_SLAVE_READ_PROCESSED:
+ *val = 0xff;
+ break;
> + if (command_size)
> + ibm_panel_process_command(panel, command_size);
I wondered if you could check for the correct command_size here, so no
need to call into the function when the size doesn't match?
> + rc = i2c_slave_register(client, ibm_panel_i2c_slave_cb);
> + if (rc) {
> + input_unregister_device(panel->input);
> + dev_err(&client->dev,
> + "Failed to register I2C slave device: %d\n", rc);
This dev_err can go. The core will print messages if something goes
wrong.
The rest looks good from an I2C point of view.
I'd think this all should go via the input tree?
Kind regards,
Wolfram
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-09-08 20:40 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-08 20:00 [PATCH v2 0/5] input: misc: Add IBM Operation Panel driver Eddie James
2020-09-08 20:00 ` Eddie James
2020-09-08 20:00 ` [PATCH v2 1/5] dt-bindings: input: Add documentation for IBM Operation Panel Eddie James
2020-09-08 20:00 ` Eddie James
2020-09-08 20:00 ` [PATCH v2 2/5] input: misc: Add IBM Operation Panel driver Eddie James
2020-09-08 20:00 ` Eddie James
2020-09-08 20:40 ` wsa [this message]
2020-09-08 20:40 ` wsa
2020-09-08 20:00 ` [PATCH v2 3/5] i2c: aspeed: Mask IRQ status to relevant bits Eddie James
2020-09-08 20:00 ` Eddie James
2020-09-09 2:59 ` Tao Ren
2020-09-09 2:59 ` Tao Ren
2020-09-09 7:59 ` kernel test robot
2020-09-09 7:59 ` kernel test robot
2020-09-09 7:59 ` kernel test robot
2020-09-09 8:01 ` kernel test robot
2020-09-09 8:01 ` kernel test robot
2020-09-09 8:01 ` kernel test robot
2020-09-08 20:01 ` [PATCH v2 4/5] ARM: dts: Aspeed: Tacoma: Add IBM Operation Panel I2C device Eddie James
2020-09-08 20:01 ` Eddie James
2020-09-09 6:56 ` Joel Stanley
2020-09-09 6:56 ` Joel Stanley
2020-09-08 20:01 ` [PATCH v2 5/5] ARM: dts: Aspeed: Rainier: " Eddie James
2020-09-08 20:01 ` Eddie James
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200908204051.GA46393@kunai \
--to=wsa@kernel.org \
--cc=linux-aspeed@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.