Bug 231625

Summary: [patch] provide MODULE_PNP_INFO() for iwm(4)
Product: Base System Reporter: Yuri Pankov <yuripv>
Component: wirelessAssignee: Bjoern A. Zeeb <bz>
Status: Closed FIXED    
Severity: Affects Only Me CC: bz, cem
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
add MODULE_PNP_INFO() to iwm(4)
none
add MODULE_PNP_INFO() to iwm(4) none

Description Yuri Pankov 2018-09-23 11:21:06 UTC
Created attachment 197394 [details]
add MODULE_PNP_INFO() to iwm(4)

Provide MODULE_PNP_INFO() for iwm(4).  The added vendor field is redundant and useless, but looks like there's no other way. 

Tested that if_iwm.ko and iwm8265fw.ko were autoloaded on boot for "iwm0: <Intel(R) Dual Band Wireless AC 8265> mem 0xecd00000-0xecd01fff at device 0.0 on pci3".
Comment 1 Yuri Pankov 2018-09-25 18:17:26 UTC
Created attachment 197497 [details]
add MODULE_PNP_INFO() to iwm(4)

I was spoon-fed the 'T' descriptor, which makes this really simple.
Comment 2 commit-hook freebsd_committer freebsd_triage 2018-09-29 21:15:30 UTC
A commit references this bug:

Author: bz
Date: Sat Sep 29 21:14:54 UTC 2018
New revision: 339020
URL: https://svnweb.freebsd.org/changeset/base/339020

Log:
  Provide MODULE_PNP_INFO() for iwm(4) so that devmatch(8) can
  do its job.

  PR:		231625
  Submitted by:	Yuri Pankov (yuripv yuripv.net)
  Approved by:	re (kib)

Changes:
  head/sys/dev/iwm/if_iwm.c
Comment 3 Bjoern A. Zeeb freebsd_committer freebsd_triage 2018-09-29 21:43:49 UTC
It seems most MODULE_PNP_INFO() was never MFCed to 11.  I'll close this and can MFC when all the other gets merged as well (note: different syntax as of a few days ago)
Comment 4 Yuri Pankov 2018-09-30 08:30:02 UTC
Committed change seems to differ from what was in the patch, specifically it doesn't match the prototype described in MODULE_PNP_INFO(9), where second argument is a bus name.  Was the change intentional?
Comment 5 Bjoern A. Zeeb freebsd_committer freebsd_triage 2018-09-30 20:53:00 UTC
(In reply to Yuri Pankov from comment #4)

No, I had to edit out sizeof(iwm_devices[0]) and screwed up when moving things to the machine to commit.  Sigh.  Let me get this sorted right away.

Can you confirm that this fix will be right?

Index: sys/dev/iwm/if_iwm.c
===================================================================
--- sys/dev/iwm/if_iwm.c        (revision 339020)
+++ sys/dev/iwm/if_iwm.c        (working copy)
@@ -6460,7 +6460,7 @@ static driver_t iwm_pci_driver = {
 static devclass_t iwm_devclass;

 DRIVER_MODULE(iwm, pci, iwm_pci_driver, iwm_devclass, NULL, NULL);
-MODULE_PNP_INFO("U16:device;P:#;T:vendor=0x8086", iwm_pci_driver, iwm,
+MODULE_PNP_INFO("U16:device;P:#;T:vendor=0x8086", pci, iwm_pci_driver,
     iwm_devices, nitems(iwm_devices));
 MODULE_DEPEND(iwm, firmware, 1, 1, 1);
 MODULE_DEPEND(iwm, pci, 1, 1, 1);
Comment 6 Yuri Pankov 2018-10-01 03:41:05 UTC
Yes, this looks correct, thank you.
Comment 7 Yuri Pankov 2018-10-01 03:42:52 UTC
Oh, sorry, just woke up, the new line should read:

MODULE_PNP_INFO("U16:device;P:#;T:vendor=0x8086", pci, iwm_pci_driver,
    iwm_devices, sizeof(iwm_devices[0]), nitems(iwm_devices));
Comment 8 Conrad Meyer freebsd_committer freebsd_triage 2018-10-01 04:01:17 UTC
(In reply to Yuri Pankov from comment #7)
That one's wrong -- "sizeof(iwm_devices[0])" parameter is removed after r338948.
Comment 9 Conrad Meyer freebsd_committer freebsd_triage 2018-10-01 04:01:49 UTC
(I think comment #5 is correct.)
Comment 10 Yuri Pankov 2018-10-01 04:08:28 UTC
Yes, you and Bjoern are correct, sorry I missed the change. And the diff in comment #5 is correct as well.
Comment 11 commit-hook freebsd_committer freebsd_triage 2018-10-01 10:45:14 UTC
A commit references this bug:

Author: bz
Date: Mon Oct  1 10:44:34 UTC 2018
New revision: 339038
URL: https://svnweb.freebsd.org/changeset/base/339038

Log:
  Fix the MODULE_PNP_INFO() for iwm(4) where I got the bus and module
  arguments wrong in r339020.

  PR:			231625
  Reported by:		Yuri Pankov (yuripv yuripv.net)
  Reviewed by:		cem, Yuri Pankov (yuripv yuripv.net)
  Approved by:		re (kib)
  Pointyhat to:		bz (a rather big one for this one)

Changes:
  head/sys/dev/iwm/if_iwm.c
Comment 12 Bjoern A. Zeeb freebsd_committer freebsd_triage 2018-10-01 16:00:23 UTC
Close this, take #2