From owner-freebsd-mobile Sun Aug 20 1:48:45 2000 Delivered-To: freebsd-mobile@freebsd.org Received: from tasogare.imasy.or.jp (tasogare.imasy.or.jp [202.227.24.5]) by hub.freebsd.org (Postfix) with ESMTP id 8BCF337B43E for ; Sun, 20 Aug 2000 01:48:42 -0700 (PDT) Received: from localhost (iwasaki.imasy.or.jp [202.227.24.92]) by tasogare.imasy.or.jp (8.10.2+3.3W/3.7W-tasogare/smtpfeed 1.07) with ESMTP id e7K8mbr42125; Sun, 20 Aug 2000 17:48:38 +0900 (JST) (envelope-from iwasaki@jp.FreeBSD.org) To: sanpei@sanpei.org Cc: mobile@FreeBSD.org Subject: Re: [PCCARD,PATCH] IOC_GET_RESOURCE_RANGE patch In-Reply-To: <200008200445.e7K4jp402239@lavender.sanpei.org> References: <200008200445.e7K4jp402239@lavender.sanpei.org> X-Mailer: Mew version 1.94.1 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20000820174828I.iwasaki@jp.FreeBSD.org> Date: Sun, 20 Aug 2000 17:48:28 +0900 From: Mitsuru IWASAKI X-Dispatcher: imput version 20000228(IM140) Lines: 41 Sender: owner-freebsd-mobile@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > I created experimental IOC_GET_RESOURCE_RANGE(but rename > PIOCSRESOURCE) ioctl code in sys/pccard which was suggested by > Warner-san. With below patch we could read free ioport/irq/memory > resources from userland programs. Great! I thought it should be done by adding new API to resource manager (in subr_rman.c ?) in order to obtain available resource range but try & error method also seems just enough for OLDCARD :-) BTW, I have few things to suggest. > + struct pccard_devinfo *devi; [snip] > + case PIOCSRESOURCE: /* sanpei */ > + pr = (struct pccard_resource *)data; > + pr->resource_addr = ~0ul; > + pccarddev = devclass_get_device(pccard_devclass, 0); > + MALLOC(devi, struct pccard_devinfo *, sizeof(*devi), M_DEVBUF, M_WAITOK); Do we need to malloc for pccard_devinfo dynamically? Also it seems there is a memory leakage bug here. Auto variable just enough for this I think. > + strcpy(devi->name, "ed"); Why "ed" ? I think this is a dummy driver name so "pccard" or "null" would be suitable rather than "ed", it's not big deal though, I could be wrong :-) > + if (!err) { > + r = bus_alloc_resource(child, pr->type, &rid, 0ul, ~0ul, pr->size, RF_ACTIVE); Maybe we don't need activate the resource actually here, just give 0 as flag instead of RF_ACTIVE. > + default: > + return EINVAL; I prefer that this kind of error checking comes first, it's not big deal though too. Thanks To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message