git: b4600b137808 - stable/13 - hptiop: Store softc pointer in si_drv1 of cdev.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 20 May 2022 00:20:54 UTC
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b4600b13780847f8c9e4369ee1fa2bf7b8913399 commit b4600b13780847f8c9e4369ee1fa2bf7b8913399 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2022-04-21 17:29:13 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2022-05-19 21:31:53 +0000 hptiop: Store softc pointer in si_drv1 of cdev. Rather than fetching the softc using the controller's unit number as an index into the devclass. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D34993 (cherry picked from commit 517a8a715a8aa94071c058491d22c464a7962f74) --- sys/dev/hptiop/hptiop.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/dev/hptiop/hptiop.c b/sys/dev/hptiop/hptiop.c index eddc8da5bd8e..4091a8fb2822 100644 --- a/sys/dev/hptiop/hptiop.c +++ b/sys/dev/hptiop/hptiop.c @@ -166,7 +166,7 @@ static struct cdevsw hptiop_cdevsw = { }; #define hba_from_dev(dev) \ - ((struct hpt_iop_hba *)devclass_get_softc(hptiop_devclass, dev2unit(dev))) + ((struct hpt_iop_hba *)((dev)->si_drv1)) #define BUS_SPACE_WRT4_ITL(offset, value) bus_space_write_4(hba->bar0t,\ hba->bar0h, offsetof(struct hpt_iopmu_itl, offset), (value)) @@ -1874,6 +1874,7 @@ static int hptiop_probe(device_t dev) static int hptiop_attach(device_t dev) { + struct make_dev_args args; struct hpt_iop_hba *hba = (struct hpt_iop_hba *)device_get_softc(dev); struct hpt_iop_request_get_config iop_config; struct hpt_iop_request_set_config set_config; @@ -2071,10 +2072,14 @@ static int hptiop_attach(device_t dev) hba->ops->enable_intr(hba); hba->initialized = 1; - hba->ioctl_dev = make_dev(&hptiop_cdevsw, unit, - UID_ROOT, GID_WHEEL /*GID_OPERATOR*/, - S_IRUSR | S_IWUSR, "%s%d", driver_name, unit); + make_dev_args_init(&args); + args.mda_devsw = &hptiop_cdevsw; + args.mda_uid = UID_ROOT; + args.mda_gid = GID_WHEEL /*GID_OPERATOR*/; + args.mda_mode = S_IRUSR | S_IWUSR; + args.mda_si_drv1 = hba; + make_dev_s(&args, &hba->ioctl_dev, "%s%d", driver_name, unit); return 0;