From nobody Thu Apr 21 17:30:14 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A086019913A5; Thu, 21 Apr 2022 17:30:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Kkl122QkLz4WYd; Thu, 21 Apr 2022 17:30:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650562214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=t6SqEgR7JlHa+IcyVGkAnDQWoVOYLK6DbVY4aikzZ0E=; b=Gt08wyjWM4vpYL6KuhbLJuyxVGuYsuPVinuLS99t5oQ5gTI0YTk4HrpG8yluJP68JCeFE9 OZOoOU4Hz+cU36nBnc3yKQXyCdnIZ6wxmUcFrvVc3k2ILZWkZKbPrl0P+fYhtlUiVa08Fs qhg/FuYoYHRln9GZJN8gmrWVPbJCJye++/TyVIKhavzb1m89ar7lYxhNLU/B0CkJJJ2xkT 4XnnfnCDd0hStuvMhLA6xbRFc4pUb/Ia1U3WEkEkmj6D/ymIwPG3ZIkO2nyP3m2nWvyzMs rN+oCKU4uTTW8YcJNyiykm+sifaZ9ZYtTjQmNkOubc2UkRKWJnklgLt6mAH0mQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EE295133; Thu, 21 Apr 2022 17:30:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 23LHUEHe004647; Thu, 21 Apr 2022 17:30:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23LHUERb004641; Thu, 21 Apr 2022 17:30:14 GMT (envelope-from git) Date: Thu, 21 Apr 2022 17:30:14 GMT Message-Id: <202204211730.23LHUERb004641@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: a9e5e04e6468 - main - arcmsr: Store softc pointer in si_drv1 of cdev. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a9e5e04e6468e7ad9d17a8fe73b2bc7091894934 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650562214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=t6SqEgR7JlHa+IcyVGkAnDQWoVOYLK6DbVY4aikzZ0E=; b=oZZx9A9ILU7DotaEwuIADBFRHixy5vxvE4ZxJ+1FSm2/WZ6bxcOsJYr4mM/XfvX9A7Jn+y N0RV4vdGjj/gss1E4Ck1xTMJgXkBT+IKSM6RC9c0VgbJxjjWtTT6z2YY9Lq0E8NkorDaWR 7LlaYqp7FpKfQL3K6tpTeX4NQvYwCjHefE1WSmYWt4h29fd733OIGuBXuTJG4OmJN/wyhF VTOiS1ITxKUL9IaeWXeuDOgo8U30mhlrJo2+nZpwuZnJD0IbhxM1koO0gUsgj4EfzB/5V8 gtqpviqu/AWwWuQQ3uHC6Hwx7ETYKLoKFWtK7Hea10C0hwPPI8TMkuCcpCpPnA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650562214; a=rsa-sha256; cv=none; b=Jj/YaixBrwhI32YylbBC8S8e3m1W0y7ftd9QbmH3yhLQFxpVwsnK33XXaADwHHRWLqRzyr szxR1J0GBy57GjW3TqT56NhX/UWVJ3CnBHQnqCbDxwjTkN4rHuwq9taVhmZNkx6kC8RJQN Mqetp35nZAFIak+Ni29VBI4krk6kM422LqbT6OJ48BFpEp6Q/7Us2l/kvkuRLe0wA302UC +gpUmiBm4k6uF98xLgWT8T+EyiiRiCRX1HgfgUqgU44RFcFrI2/FPqBAyhYmO3g13DtaST TKcWVFrj2m1pmhvmYcyeh9MOu2T1MI9BLVwetAX08V/yMw5du7ynBfXtZVevRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a9e5e04e6468e7ad9d17a8fe73b2bc7091894934 commit a9e5e04e6468e7ad9d17a8fe73b2bc7091894934 Author: John Baldwin AuthorDate: 2022-04-21 17:29:14 +0000 Commit: John Baldwin CommitDate: 2022-04-21 17:29:14 +0000 arcmsr: 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/D35004 --- sys/dev/arcmsr/arcmsr.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sys/dev/arcmsr/arcmsr.c b/sys/dev/arcmsr/arcmsr.c index f39959006498..87147402d091 100644 --- a/sys/dev/arcmsr/arcmsr.c +++ b/sys/dev/arcmsr/arcmsr.c @@ -240,8 +240,7 @@ static struct cdevsw arcmsr_cdevsw={ */ static int arcmsr_open(struct cdev *dev, int flags, int fmt, struct thread *proc) { - int unit = dev2unit(dev); - struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); + struct AdapterControlBlock *acb = dev->si_drv1; if (acb == NULL) { return ENXIO; @@ -254,8 +253,7 @@ static int arcmsr_open(struct cdev *dev, int flags, int fmt, struct thread *proc */ static int arcmsr_close(struct cdev *dev, int flags, int fmt, struct thread *proc) { - int unit = dev2unit(dev); - struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); + struct AdapterControlBlock *acb = dev->si_drv1; if (acb == NULL) { return ENXIO; @@ -268,8 +266,7 @@ static int arcmsr_close(struct cdev *dev, int flags, int fmt, struct thread *pro */ static int arcmsr_ioctl(struct cdev *dev, u_long ioctl_cmd, caddr_t arg, int flags, struct thread *proc) { - int unit = dev2unit(dev); - struct AdapterControlBlock *acb = devclass_get_softc(arcmsr_devclass, unit); + struct AdapterControlBlock *acb = dev->si_drv1; if (acb == NULL) { return ENXIO; @@ -4927,6 +4924,7 @@ irq_alloc_failed: */ static int arcmsr_attach(device_t dev) { + struct make_dev_args args; struct AdapterControlBlock *acb=(struct AdapterControlBlock *)device_get_softc(dev); u_int32_t unit=device_get_unit(dev); struct ccb_setasync csa; @@ -4996,7 +4994,13 @@ irqx: xpt_action((union ccb *)&csa); ARCMSR_LOCK_RELEASE(&acb->isr_lock); /* Create the control device. */ - acb->ioctl_dev = make_dev(&arcmsr_cdevsw, unit, UID_ROOT, GID_WHEEL /* GID_OPERATOR */, S_IRUSR | S_IWUSR, "arcmsr%d", unit); + make_dev_args_init(&args); + args.mda_devsw = &arcmsr_cdevsw; + args.mda_uid = UID_ROOT; + args.mda_gid = GID_WHEEL /* GID_OPERATOR */; + args.mda_mode = S_IRUSR | S_IWUSR; + args.mda_si_drv1 = acb; + (void)make_dev_s(&args, &acb->ioctl_dev, "arcmsr%d", unit); (void)make_dev_alias(acb->ioctl_dev, "arc%d", unit); arcmsr_callout_init(&acb->devmap_callout);