Re: [RFC PATCH 2/4] usb: typec: Character device for USB Power Delivery devices

From: Greg KH
Date: Tue Oct 26 2021 - 11:08:06 EST


On Tue, Oct 26, 2021 at 05:33:50PM +0300, Heikki Krogerus wrote:
> Interim.
>
> TODO/ideas:
> - Figure out a proper magic value for the ioctl and check if
> the ioctl range is OK.
> - Register separate PD device for the cdev, and register it
> only if the device (port, plug or partner) actually
> supports USB PD (or come up with some other solution?).
> - Introduce something like
>
> struct pd_request {
> struct pd_message request;
> struct pd_message __user *response;
> };
>
> and use it instead of only single struct pd_messages everywhere.
>
> - Add compat support.

Ick, no, new ioctls should never need compat support if you create them
properly. That is only for "old" ones.

Also, why not use the miscdev api instead? That should remove some code
of yours and make things simpler, if you really want to stick with a
char device node...

thanks,

greg k-h