RE: [PATCH misc] misc: Add Renesas Synchronization Management Unit (SMU) support

From: Min Li
Date: Tue Sep 14 2021 - 16:44:00 EST


Hi Greg

Thanks for the review

> > drivers/misc/Kconfig | 9 ++
> > drivers/misc/Makefile | 2 +
> > drivers/misc/rsmu_cdev.c | 239
> > ++++++++++++++++++++++++++++++++++++++++++++++
> > drivers/misc/rsmu_cdev.h | 77 +++++++++++++++
> > drivers/misc/rsmu_cm.c | 164 +++++++++++++++++++++++++++++++
> > drivers/misc/rsmu_sabre.c | 133 ++++++++++++++++++++++++++
>
> If you make this all one .c file, the .h file can go away and it will be much
> simpler in the end. And will get rid of the global symbols.
>

That is doable. But <linux/mfd/idt8a340_reg.h> and <linux/mfd/idt82p33_reg.h> have naming confliction.
To make this change one file, I have to include both of them and therefore I have to change them to resolve
Conflicts. Can I include this

> >
> > +config RSMU
> > + tristate "Renesas Synchronization Management Unit (SMU)"
> > + help
> > + This option enables support for the IDT ClockMatrix(TM) and
> 82P33xxx
> > + families of timing and synchronization devices. It will be used by
> > + Renesas PTP Clock Manager for Linux (pcm4l) software to provide
> support
> > + for GNSS assisted partial timing support (APTS) and other
> networking
> > + timing functions.
>
> No driver name listed?

Sorry, what do you mean by driver name in this context?

>
> > diff --git a/drivers/misc/rsmu_cdev.c b/drivers/misc/rsmu_cdev.c new
> > file mode 100644 index 0000000..8e856a6
> > --- /dev/null
> > +++ b/drivers/misc/rsmu_cdev.c
> > @@ -0,0 +1,239 @@
> > +// SPDX-License-Identifier: GPL-2.0+
>
> Are you sure about "+"? I have to ask.

All of our Linux kernel code have this license. I don't know what is the catch here.

> > +
> > +/**
> > + * struct rsmu_cdev - Driver data for RSMU character device
> > + * @name: rsmu device name as rsmu[index]
> > + * @dev: pointer to device
> > + * @mfd: pointer to MFD device
> > + * @miscdev: character device handle
> > + * @regmap: I2C/SPI regmap handle
> > + * @lock: mutex to protect operations from being interrupted
> > + * @type: rsmu device type, passed through platform data
> > + * @ops: rsmu device methods
> > + * @index: rsmu device index
> > + */
> > +struct rsmu_cdev {
> > + char name[16];
> > + struct device *dev;
>
> What device is this pointing to?

It is the platform device from rsmu_probe(struct platform_device *pdev)

>
> > + struct device *mfd;
>
> What is this for?

It is the multi-functional device from driver/mfd/rsmu_core.c
The mfd driver is responsible for spawn this platform device and spi/i2c
bus access

> > +/*
> > + * RSMU IOCTL List
> > + */
> > +#define RSMU_MAGIC '?'
>
> Where did you get this value from?
>
> Where did you reserve it?

No I didn't reserve it. I checked other code and they all seem to use a random character

>
> > +
> > +/**
> > + * @Description
>
> What is this format? It is not kernel-doc :(
>
> > + * ioctl to set SMU combo mode.Combo mode provides physical layer
> > + frequency
> > + * support from the Ethernet Equipment Clock to the PTP clock
> > + *
> > + * @Parameters
>
> Same here and elsewhere in this file.

I was copying the format from xilinx_sdfec.h

Is there a place that tells me how to properly document ioctl or can you give me an code example?

Thanks

Min