Mercurial > vordog
comparison vordog.c @ 5:e59963b503cb
Remove tedious messages.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Tue, 08 Jul 2008 12:31:29 +0800 |
parents | 60a234c9c03f |
children | 76ce6e6624b8 |
comparison
equal
deleted
inserted
replaced
4:5fa5e5199d1a | 5:e59963b503cb |
---|---|
55 | 55 |
56 static int | 56 static int |
57 vordog_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { | 57 vordog_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { |
58 vd_softc_t sc; | 58 vd_softc_t sc; |
59 | 59 |
60 printf("vordog_open\n"); | |
61 sc = CDEV_2_SOFTC(dev); | 60 sc = CDEV_2_SOFTC(dev); |
62 sc->open_cnt++; | 61 sc->open_cnt++; |
63 | 62 |
64 return 0; | 63 return 0; |
65 } | 64 } |
66 | 65 |
67 static int | 66 static int |
68 vordog_close(struct cdev *dev, int fflag, int devtype, struct thread *td) { | 67 vordog_close(struct cdev *dev, int fflag, int devtype, struct thread *td) { |
69 vd_softc_t sc; | 68 vd_softc_t sc; |
70 | 69 |
71 printf("vordog_close\n"); | |
72 sc = CDEV_2_SOFTC(dev); | 70 sc = CDEV_2_SOFTC(dev); |
73 sc->open_cnt--; | 71 sc->open_cnt--; |
74 | 72 |
75 return 0; | 73 return 0; |
76 } | 74 } |
79 vordog_go_detach(void) { | 77 vordog_go_detach(void) { |
80 devclass_t vd_dc; | 78 devclass_t vd_dc; |
81 device_t vd_dev, nexus_dev; | 79 device_t vd_dev, nexus_dev; |
82 int r; | 80 int r; |
83 | 81 |
84 printf("go_detach 1\n"); | |
85 vd_dc = devclass_find("vordog"); | 82 vd_dc = devclass_find("vordog"); |
86 if(vd_dc == NULL) | 83 if(vd_dc == NULL) |
87 return EINVAL; | 84 return EINVAL; |
88 | 85 |
89 printf("go_detach 2\n"); | |
90 vd_dev = devclass_get_device(vd_dc, 0); | 86 vd_dev = devclass_get_device(vd_dc, 0); |
91 if(vd_dev == NULL) | 87 if(vd_dev == NULL) |
92 return EINVAL; | 88 return EINVAL; |
93 | 89 |
94 printf("go_detach 3\n"); | |
95 nexus_dev = device_get_parent(vd_dev); | 90 nexus_dev = device_get_parent(vd_dev); |
96 if(nexus_dev == NULL) | 91 if(nexus_dev == NULL) |
97 return EINVAL; | 92 return EINVAL; |
98 | 93 |
99 printf("go_detach 4\n"); | |
100 r = device_delete_child(nexus_dev, vd_dev); | 94 r = device_delete_child(nexus_dev, vd_dev); |
101 return r; | 95 return r; |
102 } | 96 } |
103 | 97 |
104 static void | 98 static void |
154 .d_open = vordog_open, | 148 .d_open = vordog_open, |
155 .d_close = vordog_close, | 149 .d_close = vordog_close, |
156 .d_ioctl = vordog_ioctl, | 150 .d_ioctl = vordog_ioctl, |
157 .d_name = "vordog", | 151 .d_name = "vordog", |
158 }; | 152 }; |
153 | |
154 /* Following implements a new bus device. | |
155 * It is attached under nexus bus, an on board device as `vordog0'. | |
156 */ | |
159 | 157 |
160 static void vordog_identify(driver_t *driver, device_t parent) { | 158 static void vordog_identify(driver_t *driver, device_t parent) { |
161 device_t vordog; | 159 device_t vordog; |
162 | 160 |
163 /* make sure vordog device is not in the bus. */ | 161 /* make sure vordog device is not in the bus. */ |