git: 517a8a715a8a - main - hptiop: Store softc pointer in si_drv1 of cdev.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 21 Apr 2022 17:30:03 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=517a8a715a8aa94071c058491d22c464a7962f74 commit 517a8a715a8aa94071c058491d22c464a7962f74 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2022-04-21 17:29:13 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2022-04-21 17:29:13 +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 --- 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 773b30948ed9..9b25f59bc883 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)) @@ -1870,6 +1870,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; @@ -2068,10 +2069,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;