Re: [PATCH v7 1/5] net: wan: Add support for QMC HDLC

2024-03-13 Thread Michael Ellerman
Hi Herve,

Herve Codina  writes:
> The QMC HDLC driver provides support for HDLC using the QMC (QUICC
> Multichannel Controller) to transfer the HDLC data.
...
>  
> diff --git a/drivers/net/wan/fsl_qmc_hdlc.c b/drivers/net/wan/fsl_qmc_hdlc.c
> new file mode 100644
> index ..5fd7ed325f5b
> --- /dev/null
> +++ b/drivers/net/wan/fsl_qmc_hdlc.c
> @@ -0,0 +1,419 @@
...
> +static int qmc_hdlc_remove(struct platform_device *pdev)
> +{
> + struct qmc_hdlc *qmc_hdlc = platform_get_drvdata(pdev);
> +
> + unregister_hdlc_device(qmc_hdlc->netdev);
> + free_netdev(qmc_hdlc->netdev);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id qmc_hdlc_id_table[] = {
> + { .compatible = "fsl,qmc-hdlc" },
> + {} /* sentinel */
> +};
> +MODULE_DEVICE_TABLE(of, qmc_hdlc_driver);

This breaks when building as a module (eg. ppc32_allmodconfig):

  In file included from ../include/linux/device/driver.h:21,
   from ../include/linux/device.h:32,
   from ../include/linux/dma-mapping.h:8,
   from ../drivers/net/wan/fsl_qmc_hdlc.c:13:
  ../drivers/net/wan/fsl_qmc_hdlc.c:405:25: error: ‘qmc_hdlc_driver’ undeclared 
here (not in a function); did you mean ‘qmc_hdlc_probe’?
405 | MODULE_DEVICE_TABLE(of, qmc_hdlc_driver);
| ^~~


IIUIC it should be pointing to the table, not the driver, so:

diff --git a/drivers/net/wan/fsl_qmc_hdlc.c b/drivers/net/wan/fsl_qmc_hdlc.c
index 5fd7ed325f5b..705c3681fb92 100644
--- a/drivers/net/wan/fsl_qmc_hdlc.c
+++ b/drivers/net/wan/fsl_qmc_hdlc.c
@@ -402,7 +402,7 @@ static const struct of_device_id qmc_hdlc_id_table[] = {
{ .compatible = "fsl,qmc-hdlc" },
{} /* sentinel */
 };
-MODULE_DEVICE_TABLE(of, qmc_hdlc_driver);
+MODULE_DEVICE_TABLE(of, qmc_hdlc_id_table);

 static struct platform_driver qmc_hdlc_driver = {
.driver = {


Which then builds correctly.

cheers


Re: [PATCH v7 1/5] net: wan: Add support for QMC HDLC

2024-03-14 Thread Herve Codina
Hi Michael,

On Thu, 14 Mar 2024 10:05:37 +1100
Michael Ellerman  wrote:

> Hi Herve,
> 
> Herve Codina  writes:
...
> This breaks when building as a module (eg. ppc32_allmodconfig):
> 
>   In file included from ../include/linux/device/driver.h:21,
>from ../include/linux/device.h:32,
>from ../include/linux/dma-mapping.h:8,
>from ../drivers/net/wan/fsl_qmc_hdlc.c:13:
>   ../drivers/net/wan/fsl_qmc_hdlc.c:405:25: error: ‘qmc_hdlc_driver’ 
> undeclared here (not in a function); did you mean ‘qmc_hdlc_probe’?
> 405 | MODULE_DEVICE_TABLE(of, qmc_hdlc_driver);
> | ^~~
> 
> 
> IIUIC it should be pointing to the table, not the driver, so:
> 
> diff --git a/drivers/net/wan/fsl_qmc_hdlc.c b/drivers/net/wan/fsl_qmc_hdlc.c
> index 5fd7ed325f5b..705c3681fb92 100644
> --- a/drivers/net/wan/fsl_qmc_hdlc.c
> +++ b/drivers/net/wan/fsl_qmc_hdlc.c
> @@ -402,7 +402,7 @@ static const struct of_device_id qmc_hdlc_id_table[] = {
> { .compatible = "fsl,qmc-hdlc" },
> {} /* sentinel */
>  };
> -MODULE_DEVICE_TABLE(of, qmc_hdlc_driver);
> +MODULE_DEVICE_TABLE(of, qmc_hdlc_id_table);
> 
>  static struct platform_driver qmc_hdlc_driver = {
> .driver = {
> 
> 
> Which then builds correctly.

My bad, I missed that one.
I fully agree with your modification.

Do you want me to make a patch (copy/paste of your proposed modification)
or do you plan to send the patch on your side ?

Best regards,
Hervé

-- 
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Re: [PATCH v7 1/5] net: wan: Add support for QMC HDLC

2024-03-14 Thread Michael Ellerman
Herve Codina  writes:
> Hi Michael,
>
> On Thu, 14 Mar 2024 10:05:37 +1100
> Michael Ellerman  wrote:
>
>> Hi Herve,
>> 
>> Herve Codina  writes:
> ..
>> This breaks when building as a module (eg. ppc32_allmodconfig):
>> 
>>   In file included from ../include/linux/device/driver.h:21,
>>from ../include/linux/device.h:32,
>>from ../include/linux/dma-mapping.h:8,
>>from ../drivers/net/wan/fsl_qmc_hdlc.c:13:
>>   ../drivers/net/wan/fsl_qmc_hdlc.c:405:25: error: ‘qmc_hdlc_driver’ 
>> undeclared here (not in a function); did you mean ‘qmc_hdlc_probe’?
>> 405 | MODULE_DEVICE_TABLE(of, qmc_hdlc_driver);
>> | ^~~
>> 
>> 
>> IIUIC it should be pointing to the table, not the driver, so:
>> 
>> diff --git a/drivers/net/wan/fsl_qmc_hdlc.c b/drivers/net/wan/fsl_qmc_hdlc.c
>> index 5fd7ed325f5b..705c3681fb92 100644
>> --- a/drivers/net/wan/fsl_qmc_hdlc.c
>> +++ b/drivers/net/wan/fsl_qmc_hdlc.c
>> @@ -402,7 +402,7 @@ static const struct of_device_id qmc_hdlc_id_table[] = {
>> { .compatible = "fsl,qmc-hdlc" },
>> {} /* sentinel */
>>  };
>> -MODULE_DEVICE_TABLE(of, qmc_hdlc_driver);
>> +MODULE_DEVICE_TABLE(of, qmc_hdlc_id_table);
>> 
>>  static struct platform_driver qmc_hdlc_driver = {
>> .driver = {
>> 
>> 
>> Which then builds correctly.
>
> My bad, I missed that one.
> I fully agree with your modification.
>
> Do you want me to make a patch (copy/paste of your proposed modification)
> or do you plan to send the patch on your side ?

Yes if you can please turn it into a proper patch and submit it.

No need to add my SoB, it's trivial.

cheers