Re: [PATCH v4 2/2] usb: typec: ucsi: Implement ChromeOS UCSI driver
From: Pavan Holla
Date: Wed Apr 10 2024 - 18:28:48 EST
I plan to upload the next version after related EC changes land on
ChromeOS. That might take a few weeks.
On Tue, Apr 9, 2024 at 8:16 AM Greg Kroah-Hartman
<gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Tue, Apr 09, 2024 at 02:27:37AM +0000, Pavan Holla wrote:
> > +#define DRV_NAME "cros-ec-ucsi"
>
> KBUILD_MODNAME?
Will replace DRV_NAME with KBUILD_MODNAME.
> > +
> > +#define MAX_EC_DATA_SIZE 256
> > +#define WRITE_TMO_MS 500
>
> What are these and why these values? And tabs perhaps?
MAX_EC_DATA_SIZE is the number of bytes that can be read or written to in the
UCSI data structure using a single host command to the EC.
WRITE_TMO_MS is the time within which a cmd complete or ack notification must
arrive after a command is sent to the PPM.
Will add comments and tabs.
> > + uint8_t ec_buffer[MAX_EC_DATA_SIZE + sizeof(struct ec_params_ucsi_ppm_set)];
>
> That's a lot of data on the stack, are you sure you want to do that?
>
> And are you sure you are allowed to have this data on the stack? It
> never ends up being sent using DMA?
I confirmed that this data isn't DMA'ed. However, I don't mind putting
it on the heap, and will do so in the next version.
> And please, don't use non-kernel types like "uint8_t", use "u8" like
> intended. This isn't userspace (yes, I know a lot of kernel code uses
> these, but as you are going to change this, might as well change that
> too.)
Ack.
Thanks,
Pavan