Re: [PATCH v2] drivers/cdrom: improved ioctl for media change detection

From: Phillip Potter
Date: Thu Sep 09 2021 - 19:08:08 EST


On Thu, Sep 09, 2021 at 09:04:28PM +0300, Lukas Prediger wrote:
> Hey Phil,
>
> thanks for taking the time to look at this and give feedback.
>

No problem, and great work :-)

> > Dear Lukas,
> >
> > Thank you for the patch, much appreciated and looks great. One very
> > minor thing though has jumped out at me after running checkpatch though:
> >
> > > --- a/include/uapi/linux/cdrom.h
> > > +++ b/include/uapi/linux/cdrom.h
> > > @@ -147,6 +147,8 @@
> > > #define CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */
> > > #define CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */
> > >
> > > +#define CDROM_TIMED_MEDIA_CHANGE 0x5396 /* get the timestamp of the last media change */
> > > +
> > > /*******************************************************
> > > * CDROM IOCTL structures
> > > *******************************************************/
> > > @@ -295,6 +297,19 @@ struct cdrom_generic_command
> > > };
> > > };
> > >
> > > +/* This struct is used by CDROM_TIMED_MEDIA_CHANGE */
> > > +struct cdrom_timed_media_change_info
> > > +{
> >
> > This opening brace should be on the same line as the struct definition
> > as per current style rules.
>
> I also noted that checkpatch reported this and that it is technically a style breach,
> however I kept the brace in the newline to be consistent with all the other
> cdrom ioctl structs defined above this in the same file for consistency.
> I have no strong feelings about this, though, so we could change this.
>

I take your point, but my personal preference would be to not introduce
code that has new checkpatch errors or warnings, where possible.

Indeed, it may be worth correcting other code in the driver that would
trigger checkpatch violations, and this is something I will look at, provided
it makes sense and isn't too much churn for what are non-semantic changes to
a very stable driver. Many thanks.

Regards,
Phil