Page MenuHomeFreeBSD

nvdimm: Use devclass_lookup to find devclasses.
ClosedPublic

Authored by jhb on Apr 26 2022, 12:12 AM.
Tags
None
Referenced Files
F132653850: D35062.id105752.diff
Sat, Oct 18, 7:09 PM
F132653847: D35062.id105719.diff
Sat, Oct 18, 7:09 PM
F132653846: D35062.id105465.diff
Sat, Oct 18, 7:09 PM
F132653835: D35062.id105418.diff
Sat, Oct 18, 7:08 PM
F132653826: D35062.id.diff
Sat, Oct 18, 7:08 PM
F132623864: D35062.id105719.diff
Sat, Oct 18, 12:55 PM
F132604360: D35062.diff
Sat, Oct 18, 8:43 AM
Unknown Object (File)
Fri, Oct 10, 2:51 PM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Apr 26 2022, 12:12 AM
sys/dev/nvdimm/nvdimm_e820.c
370

I more like this and less like string literal in the chunk for nvdimm.c. As I understand, it must be identical to the string pointed from the driver_t. Can we somehow reuse the pointer to the same string?

[I have no idea why these changes are done, which I see are done systematically for all drivers. If what I said above just makes some plan harder, just disregard it at all and go ahead with the change. I have zero objections.]

sys/dev/nvdimm/nvdimm_e820.c
370

these changes == use of devclass_find() instead of referencing the explicitly declared devclass

sys/dev/nvdimm/nvdimm_e820.c
370

I did recently change some xen drivers to use 'driver->name' in the identify hooks which leaves the driver_t name field as the only bare string constant. I have not done a sweep to prefer that, but I could do so. For a module handler like this we could change the DRIVER_MODULE line to pass in the driver_t as the void *arg and then get to driver->name that way.

The reason for the changes is that in the vast majority of drivers, the devclass argument to DRIVER_MODULE is unused, so I'm removing it from the API. (I've already deprecated it in head and plan to MFC the change that permits both old and new macro invocations to older branches).

kib added inline comments.
sys/dev/nvdimm/nvdimm_e820.c
370

I prefer to have only one instance of the string literal, preferably one instance in the final object, not just in the source (with a macro).

This revision is now accepted and ready to land.Apr 26 2022, 9:22 PM

Use driver name for nvdimm_e820.

This revision now requires review to proceed.Apr 27 2022, 3:39 PM
sys/dev/nvdimm/nvdimm.c
303–304

So why not nvdimm_driver.name there?

sys/dev/nvdimm/nvdimm.c
303–304

Mostly because I need to move it earlier (or move this function later). I guess I can try to figure out the least terrible way to do that.

Move function around to use nvdimm_driver.name.

This revision is now accepted and ready to land.May 6 2022, 1:23 PM
This revision was automatically updated to reflect the committed changes.