i2c.c (c1f3ee120bb61045b1c0a3ead620d1d65af47130) | i2c.c (5e246b850df563224be26f1d409cf66fd6c968df) |
---|---|
1/* 2 * Generic i2c interface for ALSA 3 * 4 * (c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de> 5 * Modified for the ALSA driver by Jaroslav Kysela <perex@perex.cz> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by --- 35 unchanged lines hidden (view full) --- 44 .probeaddr = snd_i2c_bit_probeaddr, 45}; 46 47static int snd_i2c_bus_free(struct snd_i2c_bus *bus) 48{ 49 struct snd_i2c_bus *slave; 50 struct snd_i2c_device *device; 51 | 1/* 2 * Generic i2c interface for ALSA 3 * 4 * (c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de> 5 * Modified for the ALSA driver by Jaroslav Kysela <perex@perex.cz> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by --- 35 unchanged lines hidden (view full) --- 44 .probeaddr = snd_i2c_bit_probeaddr, 45}; 46 47static int snd_i2c_bus_free(struct snd_i2c_bus *bus) 48{ 49 struct snd_i2c_bus *slave; 50 struct snd_i2c_device *device; 51 |
52 snd_assert(bus != NULL, return -EINVAL); | 52 if (snd_BUG_ON(!bus)) 53 return -EINVAL; |
53 while (!list_empty(&bus->devices)) { 54 device = snd_i2c_device(bus->devices.next); 55 snd_i2c_device_free(device); 56 } 57 if (bus->master) 58 list_del(&bus->buses); 59 else { 60 while (!list_empty(&bus->buses)) { --- 47 unchanged lines hidden (view full) --- 108EXPORT_SYMBOL(snd_i2c_bus_create); 109 110int snd_i2c_device_create(struct snd_i2c_bus *bus, const char *name, 111 unsigned char addr, struct snd_i2c_device **rdevice) 112{ 113 struct snd_i2c_device *device; 114 115 *rdevice = NULL; | 54 while (!list_empty(&bus->devices)) { 55 device = snd_i2c_device(bus->devices.next); 56 snd_i2c_device_free(device); 57 } 58 if (bus->master) 59 list_del(&bus->buses); 60 else { 61 while (!list_empty(&bus->buses)) { --- 47 unchanged lines hidden (view full) --- 109EXPORT_SYMBOL(snd_i2c_bus_create); 110 111int snd_i2c_device_create(struct snd_i2c_bus *bus, const char *name, 112 unsigned char addr, struct snd_i2c_device **rdevice) 113{ 114 struct snd_i2c_device *device; 115 116 *rdevice = NULL; |
116 snd_assert(bus != NULL, return -EINVAL); | 117 if (snd_BUG_ON(!bus)) 118 return -EINVAL; |
117 device = kzalloc(sizeof(*device), GFP_KERNEL); 118 if (device == NULL) 119 return -ENOMEM; 120 device->addr = addr; 121 strlcpy(device->name, name, sizeof(device->name)); 122 list_add_tail(&device->list, &bus->devices); 123 device->bus = bus; 124 *rdevice = device; --- 220 unchanged lines hidden --- | 119 device = kzalloc(sizeof(*device), GFP_KERNEL); 120 if (device == NULL) 121 return -ENOMEM; 122 device->addr = addr; 123 strlcpy(device->name, name, sizeof(device->name)); 124 list_add_tail(&device->list, &bus->devices); 125 device->bus = bus; 126 *rdevice = device; --- 220 unchanged lines hidden --- |