Skip to content

Commit f37635b

Browse files
committed
Garbage-collect the "isa_knowndev" stuff; nothing used it.
1 parent 2535866 commit f37635b

File tree

2 files changed

+4
-163
lines changed

2 files changed

+4
-163
lines changed

sys/dev/isa/isa.c

Lines changed: 3 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: isa.c,v 1.141 2025/10/03 14:14:36 thorpej Exp $ */
1+
/* $NetBSD: isa.c,v 1.142 2025/10/17 16:56:00 thorpej Exp $ */
22

33
/*-
44
* Copyright (c) 1998, 2001, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
3030
*/
3131

3232
#include <sys/cdefs.h>
33-
__KERNEL_RCSID(0, "$NetBSD: isa.c,v 1.141 2025/10/03 14:14:36 thorpej Exp $");
33+
__KERNEL_RCSID(0, "$NetBSD: isa.c,v 1.142 2025/10/17 16:56:00 thorpej Exp $");
3434

3535
#include <sys/param.h>
3636
#include <sys/systm.h>
@@ -58,16 +58,11 @@ int isamatch(device_t, cfdata_t, void *);
5858
void isaattach(device_t, device_t, void *);
5959
int isadetach(device_t, int);
6060
int isarescan(device_t, const char *, const int *);
61-
void isachilddetached(device_t, device_t);
6261
int isaprint(void *, const char *);
6362

6463
CFATTACH_DECL2_NEW(isa, sizeof(struct isa_softc),
65-
isamatch, isaattach, isadetach, NULL, isarescan, isachilddetached);
64+
isamatch, isaattach, isadetach, NULL, isarescan, NULL);
6665

67-
void isa_attach_knowndevs(struct isa_softc *);
68-
void isa_free_knowndevs(struct isa_softc *);
69-
70-
int isasubmatch(device_t, cfdata_t, const int *, void *);
7166
int isasearch(device_t, cfdata_t, const int *, void *);
7267

7368
static int isa_slotcount = -1; /* -1 == don't know how many */
@@ -95,17 +90,12 @@ isaattach(device_t parent, device_t self, void *aux)
9590
[ISACF_DRQ2] = ISACF_DRQ2_DEFAULT,
9691
};
9792

98-
TAILQ_INIT(&sc->sc_knowndevs);
99-
sc->sc_dynamicdevs = 0;
100-
10193
sc->sc_dev = self;
10294

10395
isa_attach_hook(parent, self, iba);
10496
aprint_naive("\n");
10597
aprint_normal("\n");
10698

107-
/* XXX Add code to fetch known-devices. */
108-
10999
sc->sc_iot = iba->iba_iot;
110100
sc->sc_memt = iba->iba_memt;
111101
sc->sc_dmat = iba->iba_dmat;
@@ -125,16 +115,6 @@ isaattach(device_t parent, device_t self, void *aux)
125115
isa_dmainit(sc->sc_ic, sc->sc_iot, sc->sc_dmat, self);
126116
#endif
127117

128-
/* Attach all direct-config children. */
129-
isa_attach_knowndevs(sc);
130-
131-
/*
132-
* If we don't support dynamic hello/goodbye of devices,
133-
* then free the knowndevs info now.
134-
*/
135-
if (sc->sc_dynamicdevs == 0)
136-
isa_free_knowndevs(sc);
137-
138118
/* Attach all indirect-config children. */
139119
isarescan(self, NULL, wildcard);
140120

@@ -153,8 +133,6 @@ isadetach(device_t self, int flags)
153133

154134
pmf_device_deregister(self);
155135

156-
isa_free_knowndevs(sc);
157-
158136
#if NISADMA > 0
159137
isa_dmadestroy(sc->sc_ic);
160138
#endif
@@ -192,86 +170,6 @@ isarescan(device_t self, const char *ifattr, const int *locators)
192170
return (0);
193171
}
194172

195-
void
196-
isachilddetached(device_t self, device_t child)
197-
{
198-
struct isa_knowndev *ik;
199-
struct isa_softc *sc = device_private(self);
200-
201-
TAILQ_FOREACH(ik, &sc->sc_knowndevs, ik_list) {
202-
if (ik->ik_claimed == child)
203-
ik->ik_claimed = NULL;
204-
}
205-
}
206-
207-
void
208-
isa_attach_knowndevs(struct isa_softc *sc)
209-
{
210-
struct isa_attach_args ia;
211-
struct isa_knowndev *ik;
212-
213-
if (TAILQ_EMPTY(&sc->sc_knowndevs))
214-
return;
215-
216-
TAILQ_FOREACH(ik, &sc->sc_knowndevs, ik_list) {
217-
if (ik->ik_claimed != NULL)
218-
continue;
219-
220-
ia.ia_iot = sc->sc_iot;
221-
ia.ia_memt = sc->sc_memt;
222-
ia.ia_dmat = sc->sc_dmat;
223-
ia.ia_ic = sc->sc_ic;
224-
225-
ia.ia_pnpname = ik->ik_pnpname;
226-
ia.ia_pnpcompatnames = ik->ik_pnpcompatnames;
227-
228-
ia.ia_io = ik->ik_io;
229-
ia.ia_nio = ik->ik_nio;
230-
231-
ia.ia_iomem = ik->ik_iomem;
232-
ia.ia_niomem = ik->ik_niomem;
233-
234-
ia.ia_irq = ik->ik_irq;
235-
ia.ia_nirq = ik->ik_nirq;
236-
237-
ia.ia_drq = ik->ik_drq;
238-
ia.ia_ndrq = ik->ik_ndrq;
239-
240-
ia.ia_aux = NULL;
241-
242-
/* XXX should setup locator array */
243-
244-
ik->ik_claimed = config_found(sc->sc_dev, &ia, isaprint,
245-
CFARGS(.submatch = isasubmatch));
246-
}
247-
}
248-
249-
void
250-
isa_free_knowndevs(struct isa_softc *sc)
251-
{
252-
struct isa_knowndev *ik;
253-
struct isa_pnpname *ipn;
254-
255-
#define FREEIT(x) if (x != NULL) free(x, M_DEVBUF)
256-
257-
while ((ik = TAILQ_FIRST(&sc->sc_knowndevs)) != NULL) {
258-
TAILQ_REMOVE(&sc->sc_knowndevs, ik, ik_list);
259-
FREEIT(ik->ik_pnpname);
260-
while ((ipn = ik->ik_pnpcompatnames) != NULL) {
261-
ik->ik_pnpcompatnames = ipn->ipn_next;
262-
free(ipn->ipn_name, M_DEVBUF);
263-
free(ipn, M_DEVBUF);
264-
}
265-
FREEIT(ik->ik_io);
266-
FREEIT(ik->ik_iomem);
267-
FREEIT(ik->ik_irq);
268-
FREEIT(ik->ik_drq);
269-
free(ik, M_DEVBUF);
270-
}
271-
272-
#undef FREEIT
273-
}
274-
275173
static int
276174
checkattachargs(struct isa_attach_args *ia, const int *loc)
277175
{
@@ -326,17 +224,6 @@ checkattachargs(struct isa_attach_args *ia, const int *loc)
326224
return (1);
327225
}
328226

329-
int
330-
isasubmatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
331-
{
332-
struct isa_attach_args *ia = aux;
333-
334-
if (!checkattachargs(ia, cf->cf_loc))
335-
return (0);
336-
337-
return (config_match(parent, cf, aux));
338-
}
339-
340227
int
341228
isaprint(void *aux, const char *isa)
342229
{

sys/dev/isa/isavar.h

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: isavar.h,v 1.53 2009/05/12 09:10:15 cegger Exp $ */
1+
/* $NetBSD: isavar.h,v 1.54 2025/10/17 16:56:00 thorpej Exp $ */
22

33
/*-
44
* Copyright (c) 1997, 2001 The NetBSD Foundation, Inc.
@@ -120,49 +120,6 @@ struct isa_pnpname {
120120
char *ipn_name;
121121
};
122122

123-
/*
124-
* Machine-dependent code provides a list of these to describe
125-
* devices on the ISA bus which should be attached via direct
126-
* configuration.
127-
*
128-
* All of this information is dynamically allocated, so that
129-
* the ISA bus driver may free all of this information if the
130-
* bus does not support dynamic attach/detach of devices (e.g.
131-
* on a docking station).
132-
*
133-
* Some info on the "ik_key" field: This is a unique number for
134-
* each knowndev node. If, when we need to re-enumerate the
135-
* knowndevs, we discover that a node with key N is in the old
136-
* list but not in the new, the device has disappeared. Similarly,
137-
* if a node with key M is in the new list but not in the old,
138-
* the device is new. Note that the knowndevs list must be
139-
* sorted in ascending "key" order.
140-
*/
141-
struct isa_knowndev {
142-
TAILQ_ENTRY(isa_knowndev) ik_list;
143-
uintptr_t ik_key;
144-
device_t ik_claimed;
145-
146-
/*
147-
* The rest of these fields correspond to isa_attach_args
148-
* fields.
149-
*/
150-
char *ik_pnpname;
151-
struct isa_pnpname *ik_pnpcompatnames;
152-
153-
struct isa_io *ik_io;
154-
int ik_nio;
155-
156-
struct isa_iomem *ik_iomem;
157-
int ik_niomem;
158-
159-
struct isa_irq *ik_irq;
160-
int ik_nirq;
161-
162-
struct isa_drq *ik_drq;
163-
int ik_ndrq;
164-
};
165-
166123
/*
167124
* ISA driver attach arguments
168125
*/
@@ -215,9 +172,6 @@ struct isa_softc {
215172
bus_dma_tag_t sc_dmat; /* isa DMA tag */
216173

217174
isa_chipset_tag_t sc_ic;
218-
219-
TAILQ_HEAD(, isa_knowndev) sc_knowndevs;
220-
int sc_dynamicdevs;
221175
};
222176

223177
/*

0 commit comments

Comments
 (0)