Deleted Added
full compact
icee.c (302408) icee.c (323931)
1/*-
2 * Copyright (c) 2006 Warner Losh. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 9 unchanged lines hidden (view full) ---

18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24
25#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2006 Warner Losh. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 9 unchanged lines hidden (view full) ---

18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24
25#include <sys/cdefs.h>
26__FBSDID("$FreeBSD: stable/11/sys/dev/iicbus/icee.c 289727 2015-10-22 01:04:31Z ian $");
26__FBSDID("$FreeBSD: stable/11/sys/dev/iicbus/icee.c 323931 2017-09-22 15:53:22Z ian $");
27/*
28 * Generic IIC eeprom support, modeled after the AT24C family of products.
29 */
30
31#include "opt_platform.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>

--- 166 unchanged lines hidden (view full) ---

201 GID_WHEEL, 0600, "icee%d", device_get_unit(dev));
202 if (sc->cdev == NULL) {
203 return (ENOMEM);
204 }
205 sc->cdev->si_drv1 = sc;
206 return (0);
207}
208
27/*
28 * Generic IIC eeprom support, modeled after the AT24C family of products.
29 */
30
31#include "opt_platform.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>

--- 166 unchanged lines hidden (view full) ---

201 GID_WHEEL, 0600, "icee%d", device_get_unit(dev));
202 if (sc->cdev == NULL) {
203 return (ENOMEM);
204 }
205 sc->cdev->si_drv1 = sc;
206 return (0);
207}
208
209static int
210icee_detach(device_t dev)
211{
212 struct icee_softc *sc = device_get_softc(dev);
213
214 destroy_dev(sc->cdev);
215 return (0);
216}
217
209static int
210icee_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
211{
218static int
219icee_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
220{
221 struct icee_softc *sc;
212
222
223 sc = CDEV2SOFTC(dev);
224 if (device_get_state(sc->dev) < DS_BUSY)
225 device_busy(sc->dev);
226
213 return (0);
214}
215
216static int
217icee_close(struct cdev *dev, int fflag, int devtype, struct thread *td)
218{
227 return (0);
228}
229
230static int
231icee_close(struct cdev *dev, int fflag, int devtype, struct thread *td)
232{
233 struct icee_softc *sc;
219
234
235 sc = CDEV2SOFTC(dev);
236 device_unbusy(sc->dev);
220 return (0);
221}
222
223static int
224icee_read(struct cdev *dev, struct uio *uio, int ioflag)
225{
226 struct icee_softc *sc;
227 uint8_t addr[2];

--- 112 unchanged lines hidden (view full) ---

340 }
341 }
342 return error;
343}
344
345static device_method_t icee_methods[] = {
346 DEVMETHOD(device_probe, icee_probe),
347 DEVMETHOD(device_attach, icee_attach),
237 return (0);
238}
239
240static int
241icee_read(struct cdev *dev, struct uio *uio, int ioflag)
242{
243 struct icee_softc *sc;
244 uint8_t addr[2];

--- 112 unchanged lines hidden (view full) ---

357 }
358 }
359 return error;
360}
361
362static device_method_t icee_methods[] = {
363 DEVMETHOD(device_probe, icee_probe),
364 DEVMETHOD(device_attach, icee_attach),
365 DEVMETHOD(device_detach, icee_detach),
348
349 DEVMETHOD_END
350};
351
352static driver_t icee_driver = {
353 "icee",
354 icee_methods,
355 sizeof(struct icee_softc),
356};
357static devclass_t icee_devclass;
358
359DRIVER_MODULE(icee, iicbus, icee_driver, icee_devclass, 0, 0);
360MODULE_VERSION(icee, 1);
361MODULE_DEPEND(icee, iicbus, 1, 1, 1);
366
367 DEVMETHOD_END
368};
369
370static driver_t icee_driver = {
371 "icee",
372 icee_methods,
373 sizeof(struct icee_softc),
374};
375static devclass_t icee_devclass;
376
377DRIVER_MODULE(icee, iicbus, icee_driver, icee_devclass, 0, 0);
378MODULE_VERSION(icee, 1);
379MODULE_DEPEND(icee, iicbus, 1, 1, 1);