diff mbox series

[v1,net-next,1/3] ptp_ocp: Switch to use module_pci_driver() macro

Message ID 20210813122737.45860-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [v1,net-next,1/3] ptp_ocp: Switch to use module_pci_driver() macro | expand

Checks

Context Check Description
netdev/apply fail Patch does not apply to net-next
netdev/tree_selection success Clearly marked for net-next

Commit Message

Andy Shevchenko Aug. 13, 2021, 12:27 p.m. UTC
Eliminate some boilerplate code by using module_pci_driver() instead of
init/exit, and, if needed, moving the salient bits from init into probe.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/ptp/ptp_ocp.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

Comments

Jakub Kicinski Aug. 13, 2021, 6:14 p.m. UTC | #1
On Fri, 13 Aug 2021 15:27:35 +0300 Andy Shevchenko wrote:
> Eliminate some boilerplate code by using module_pci_driver() instead of
> init/exit, and, if needed, moving the salient bits from init into probe.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Jonathan has a series in flight which is fixing some of the same issues:
https://patchwork.kernel.org/project/netdevbpf/list/?series=530079&state=*

Please hold off for a day or two so it can get merged, and if you don't
mind double check at that point which of your patches are still needed.

According to patchwork your series does not apply to net-next as of
last night so it'll need a respin anyway.

Thanks!
Andy Shevchenko Aug. 13, 2021, 7:30 p.m. UTC | #2
On Fri, Aug 13, 2021 at 9:15 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Fri, 13 Aug 2021 15:27:35 +0300 Andy Shevchenko wrote:
> > Eliminate some boilerplate code by using module_pci_driver() instead of
> > init/exit, and, if needed, moving the salient bits from init into probe.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Jonathan has a series in flight which is fixing some of the same issues:
> https://patchwork.kernel.org/project/netdevbpf/list/?series=530079&state=*
>
> Please hold off for a day or two so it can get merged, and if you don't
> mind double check at that point which of your patches are still needed.

Actually it may be the other way around. Since patch 2 in his series
is definitely an unneeded churn here, because my devm conversion will
have to effectively revert it.


> According to patchwork your series does not apply to net-next as of
> last night so it'll need a respin anyway.

I hope he will chime in and see what we can do the best.
Jonathan Lemon Aug. 16, 2021, 9:01 p.m. UTC | #3
On Fri, Aug 13, 2021 at 10:30:51PM +0300, Andy Shevchenko wrote:
> On Fri, Aug 13, 2021 at 9:15 PM Jakub Kicinski <kuba@kernel.org> wrote:
> >
> > On Fri, 13 Aug 2021 15:27:35 +0300 Andy Shevchenko wrote:
> > > Eliminate some boilerplate code by using module_pci_driver() instead of
> > > init/exit, and, if needed, moving the salient bits from init into probe.
> > >
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> >
> > Jonathan has a series in flight which is fixing some of the same issues:
> > https://patchwork.kernel.org/project/netdevbpf/list/?series=530079&state=*
> >
> > Please hold off for a day or two so it can get merged, and if you don't
> > mind double check at that point which of your patches are still needed.
> 
> Actually it may be the other way around. Since patch 2 in his series
> is definitely an unneeded churn here, because my devm conversion will
> have to effectively revert it.
> 
> 
> > According to patchwork your series does not apply to net-next as of
> > last night so it'll need a respin anyway.
> 
> I hope he will chime in and see what we can do the best.

I'm going to submit a respin of the last patch, I screwed something
up from all the various trees I'm using.

Please update to net-next first - the firat patch in your series
doesn't make any longer, given the current status.
Andy Shevchenko Aug. 17, 2021, 9:48 a.m. UTC | #4
On Mon, Aug 16, 2021 at 02:01:01PM -0700, Jonathan Lemon wrote:
> On Fri, Aug 13, 2021 at 10:30:51PM +0300, Andy Shevchenko wrote:
> > On Fri, Aug 13, 2021 at 9:15 PM Jakub Kicinski <kuba@kernel.org> wrote:
> > > On Fri, 13 Aug 2021 15:27:35 +0300 Andy Shevchenko wrote:
> > > > Eliminate some boilerplate code by using module_pci_driver() instead of
> > > > init/exit, and, if needed, moving the salient bits from init into probe.
> > > >
> > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > >
> > > Jonathan has a series in flight which is fixing some of the same issues:
> > > https://patchwork.kernel.org/project/netdevbpf/list/?series=530079&state=*
> > >
> > > Please hold off for a day or two so it can get merged, and if you don't
> > > mind double check at that point which of your patches are still needed.
> > 
> > Actually it may be the other way around. Since patch 2 in his series
> > is definitely an unneeded churn here, because my devm conversion will
> > have to effectively revert it.
> > 
> > 
> > > According to patchwork your series does not apply to net-next as of
> > > last night so it'll need a respin anyway.
> > 
> > I hope he will chime in and see what we can do the best.
> 
> I'm going to submit a respin of the last patch, I screwed something
> up from all the various trees I'm using.
> 
> Please update to net-next first - the firat patch in your series
> doesn't make any longer, given the current status.

I'll rebase my stuff on top of net-next and resubmit.

Thanks!
Andy Shevchenko Aug. 17, 2021, 12:43 p.m. UTC | #5
On Tue, Aug 17, 2021 at 12:48:22PM +0300, Andy Shevchenko wrote:
> On Mon, Aug 16, 2021 at 02:01:01PM -0700, Jonathan Lemon wrote:
> > On Fri, Aug 13, 2021 at 10:30:51PM +0300, Andy Shevchenko wrote:
> > > On Fri, Aug 13, 2021 at 9:15 PM Jakub Kicinski <kuba@kernel.org> wrote:
> > > > On Fri, 13 Aug 2021 15:27:35 +0300 Andy Shevchenko wrote:
> > > > > Eliminate some boilerplate code by using module_pci_driver() instead of
> > > > > init/exit, and, if needed, moving the salient bits from init into probe.
> > > > >
> > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > >
> > > > Jonathan has a series in flight which is fixing some of the same issues:
> > > > https://patchwork.kernel.org/project/netdevbpf/list/?series=530079&state=*
> > > >
> > > > Please hold off for a day or two so it can get merged, and if you don't
> > > > mind double check at that point which of your patches are still needed.
> > > 
> > > Actually it may be the other way around. Since patch 2 in his series
> > > is definitely an unneeded churn here, because my devm conversion will
> > > have to effectively revert it.
> > > 
> > > 
> > > > According to patchwork your series does not apply to net-next as of
> > > > last night so it'll need a respin anyway.
> > > 
> > > I hope he will chime in and see what we can do the best.
> > 
> > I'm going to submit a respin of the last patch, I screwed something
> > up from all the various trees I'm using.
> > 
> > Please update to net-next first - the firat patch in your series
> > doesn't make any longer, given the current status.
> 
> I'll rebase my stuff on top of net-next and resubmit.
> 
> Thanks!

It seems the driver disrupted so much that it requires much more work
to make it neat. New code looks like a custom MFD approach (WRT resource
management).

I have sent only patch 3 out of this series and have attached here the
problematic places in my opinion. Feel free to convert them to patches
with Suggested-by tag. But converting to MFD will make this driver much
much better to read, understand and maintain.
diff mbox series

Patch

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 0d1034e3ed0f..874ea7930079 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -4,7 +4,6 @@ 
 #include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/ptp_clock_kernel.h>
 
@@ -377,24 +376,7 @@  static struct pci_driver ptp_ocp_driver = {
 	.probe		= ptp_ocp_probe,
 	.remove		= ptp_ocp_remove,
 };
-
-static int __init
-ptp_ocp_init(void)
-{
-	int err;
-
-	err = pci_register_driver(&ptp_ocp_driver);
-	return err;
-}
-
-static void __exit
-ptp_ocp_fini(void)
-{
-	pci_unregister_driver(&ptp_ocp_driver);
-}
-
-module_init(ptp_ocp_init);
-module_exit(ptp_ocp_fini);
+module_pci_driver(ptp_ocp_driver);
 
 MODULE_DESCRIPTION("OpenCompute TimeCard driver");
 MODULE_LICENSE("GPL v2");