Skip to content

Commit

Permalink
Merge pull request #44 from torvalds/master
Browse files Browse the repository at this point in the history
Sync up with Linus
  • Loading branch information
dabrace committed Feb 27, 2015
2 parents 5717af5 + 4f671fe commit b5731f4
Show file tree
Hide file tree
Showing 15 changed files with 117 additions and 62 deletions.
3 changes: 3 additions & 0 deletions drivers/hwmon/ads7828.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ static int ads7828_probe(struct i2c_client *client,
&ads2830_regmap_config);
}

if (IS_ERR(data->regmap))
return PTR_ERR(data->regmap);

data->cmd_byte = ext_vref ? ADS7828_CMD_PD1 : ADS7828_CMD_PD3;
if (!diff_input)
data->cmd_byte |= ADS7828_CMD_SD_SE;
Expand Down
9 changes: 8 additions & 1 deletion fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -4903,10 +4903,17 @@ static void sort_parity_stripes(struct btrfs_bio *bbio, int num_stripes)
static struct btrfs_bio *alloc_btrfs_bio(int total_stripes, int real_stripes)
{
struct btrfs_bio *bbio = kzalloc(
/* the size of the btrfs_bio */
sizeof(struct btrfs_bio) +
/* plus the variable array for the stripes */
sizeof(struct btrfs_bio_stripe) * (total_stripes) +
/* plus the variable array for the tgt dev */
sizeof(int) * (real_stripes) +
sizeof(u64) * (real_stripes),
/*
* plus the raid_map, which includes both the tgt dev
* and the stripes
*/
sizeof(u64) * (total_stripes),
GFP_NOFS);
if (!bbio)
return NULL;
Expand Down
2 changes: 2 additions & 0 deletions sound/core/pcm_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -1552,6 +1552,8 @@ static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state)
if (! snd_pcm_playback_empty(substream)) {
snd_pcm_do_start(substream, SNDRV_PCM_STATE_DRAINING);
snd_pcm_post_start(substream, SNDRV_PCM_STATE_DRAINING);
} else {
runtime->status->state = SNDRV_PCM_STATE_SETUP;
}
break;
case SNDRV_PCM_STATE_RUNNING:
Expand Down
5 changes: 2 additions & 3 deletions sound/firewire/amdtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
#define MAX_MIDI_RX_BLOCKS 8

#define TRANSFER_DELAY_TICKS 0x2e00 /* 479.17 µs */
#define TRANSFER_DELAY_TICKS 0x2e00 /* 479.17 microseconds */

/* isochronous header parameters */
#define ISO_DATA_LENGTH_SHIFT 16
Expand Down Expand Up @@ -78,7 +78,7 @@ static void pcm_period_tasklet(unsigned long data);
int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit,
enum amdtp_stream_direction dir, enum cip_flags flags)
{
s->unit = fw_unit_get(unit);
s->unit = unit;
s->direction = dir;
s->flags = flags;
s->context = ERR_PTR(-1);
Expand All @@ -102,7 +102,6 @@ void amdtp_stream_destroy(struct amdtp_stream *s)
{
WARN_ON(amdtp_stream_running(s));
mutex_destroy(&s->mutex);
fw_unit_put(s->unit);
}
EXPORT_SYMBOL(amdtp_stream_destroy);

Expand Down
20 changes: 16 additions & 4 deletions sound/firewire/bebob/bebob.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,22 @@ name_device(struct snd_bebob *bebob, unsigned int vendor_id)
return err;
}

/*
* This module releases the FireWire unit data after all ALSA character devices
* are released by applications. This is for releasing stream data or finishing
* transactions safely. Thus at returning from .remove(), this module still keep
* references for the unit.
*/
static void
bebob_card_free(struct snd_card *card)
{
struct snd_bebob *bebob = card->private_data;

snd_bebob_stream_destroy_duplex(bebob);
fw_unit_put(bebob->unit);

kfree(bebob->maudio_special_quirk);

if (bebob->card_index >= 0) {
mutex_lock(&devices_mutex);
clear_bit(bebob->card_index, devices_used);
Expand Down Expand Up @@ -205,7 +216,7 @@ bebob_probe(struct fw_unit *unit,
card->private_free = bebob_card_free;

bebob->card = card;
bebob->unit = unit;
bebob->unit = fw_unit_get(unit);
bebob->spec = spec;
mutex_init(&bebob->mutex);
spin_lock_init(&bebob->lock);
Expand Down Expand Up @@ -306,10 +317,11 @@ static void bebob_remove(struct fw_unit *unit)
if (bebob == NULL)
return;

kfree(bebob->maudio_special_quirk);
/* Awake bus-reset waiters. */
if (!completion_done(&bebob->bus_reset))
complete_all(&bebob->bus_reset);

snd_bebob_stream_destroy_duplex(bebob);
snd_card_disconnect(bebob->card);
/* No need to wait for releasing card object in this context. */
snd_card_free_when_closed(bebob->card);
}

Expand Down
16 changes: 4 additions & 12 deletions sound/firewire/bebob/bebob_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,6 @@ break_both_connections(struct snd_bebob *bebob)
static void
destroy_both_connections(struct snd_bebob *bebob)
{
break_both_connections(bebob);

cmp_connection_destroy(&bebob->in_conn);
cmp_connection_destroy(&bebob->out_conn);
}
Expand Down Expand Up @@ -712,22 +710,16 @@ void snd_bebob_stream_update_duplex(struct snd_bebob *bebob)
mutex_unlock(&bebob->mutex);
}

/*
* This function should be called before starting streams or after stopping
* streams.
*/
void snd_bebob_stream_destroy_duplex(struct snd_bebob *bebob)
{
mutex_lock(&bebob->mutex);

amdtp_stream_pcm_abort(&bebob->rx_stream);
amdtp_stream_pcm_abort(&bebob->tx_stream);

amdtp_stream_stop(&bebob->rx_stream);
amdtp_stream_stop(&bebob->tx_stream);

amdtp_stream_destroy(&bebob->rx_stream);
amdtp_stream_destroy(&bebob->tx_stream);

destroy_both_connections(bebob);

mutex_unlock(&bebob->mutex);
}

/*
Expand Down
18 changes: 12 additions & 6 deletions sound/firewire/dice/dice-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,21 @@ static int init_stream(struct snd_dice *dice, struct amdtp_stream *stream)
return err;
}

/*
* This function should be called before starting streams or after stopping
* streams.
*/
static void destroy_stream(struct snd_dice *dice, struct amdtp_stream *stream)
{
amdtp_stream_destroy(stream);
struct fw_iso_resources *resources;

if (stream == &dice->tx_stream)
fw_iso_resources_destroy(&dice->tx_resources);
resources = &dice->tx_resources;
else
fw_iso_resources_destroy(&dice->rx_resources);
resources = &dice->rx_resources;

amdtp_stream_destroy(stream);
fw_iso_resources_destroy(resources);
}

int snd_dice_stream_init_duplex(struct snd_dice *dice)
Expand All @@ -332,6 +339,8 @@ int snd_dice_stream_init_duplex(struct snd_dice *dice)
goto end;

err = init_stream(dice, &dice->rx_stream);
if (err < 0)
destroy_stream(dice, &dice->tx_stream);
end:
return err;
}
Expand All @@ -340,10 +349,7 @@ void snd_dice_stream_destroy_duplex(struct snd_dice *dice)
{
snd_dice_transaction_clear_enable(dice);

stop_stream(dice, &dice->tx_stream);
destroy_stream(dice, &dice->tx_stream);

stop_stream(dice, &dice->rx_stream);
destroy_stream(dice, &dice->rx_stream);

dice->substreams_counter = 0;
Expand Down
16 changes: 11 additions & 5 deletions sound/firewire/dice/dice.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,20 @@ static void dice_card_strings(struct snd_dice *dice)
strcpy(card->mixername, "DICE");
}

/*
* This module releases the FireWire unit data after all ALSA character devices
* are released by applications. This is for releasing stream data or finishing
* transactions safely. Thus at returning from .remove(), this module still keep
* references for the unit.
*/
static void dice_card_free(struct snd_card *card)
{
struct snd_dice *dice = card->private_data;

snd_dice_stream_destroy_duplex(dice);
snd_dice_transaction_destroy(dice);
fw_unit_put(dice->unit);

mutex_destroy(&dice->mutex);
}

Expand All @@ -251,7 +260,7 @@ static int dice_probe(struct fw_unit *unit, const struct ieee1394_device_id *id)

dice = card->private_data;
dice->card = card;
dice->unit = unit;
dice->unit = fw_unit_get(unit);
card->private_free = dice_card_free;

spin_lock_init(&dice->lock);
Expand Down Expand Up @@ -305,10 +314,7 @@ static void dice_remove(struct fw_unit *unit)
{
struct snd_dice *dice = dev_get_drvdata(&unit->device);

snd_card_disconnect(dice->card);

snd_dice_stream_destroy_duplex(dice);

/* No need to wait for releasing card object in this context. */
snd_card_free_when_closed(dice->card);
}

Expand Down
20 changes: 14 additions & 6 deletions sound/firewire/fireworks/fireworks.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,30 @@ get_hardware_info(struct snd_efw *efw)
return err;
}

/*
* This module releases the FireWire unit data after all ALSA character devices
* are released by applications. This is for releasing stream data or finishing
* transactions safely. Thus at returning from .remove(), this module still keep
* references for the unit.
*/
static void
efw_card_free(struct snd_card *card)
{
struct snd_efw *efw = card->private_data;

snd_efw_stream_destroy_duplex(efw);
snd_efw_transaction_remove_instance(efw);
fw_unit_put(efw->unit);

kfree(efw->resp_buf);

if (efw->card_index >= 0) {
mutex_lock(&devices_mutex);
clear_bit(efw->card_index, devices_used);
mutex_unlock(&devices_mutex);
}

mutex_destroy(&efw->mutex);
kfree(efw->resp_buf);
}

static int
Expand Down Expand Up @@ -218,7 +229,7 @@ efw_probe(struct fw_unit *unit,
card->private_free = efw_card_free;

efw->card = card;
efw->unit = unit;
efw->unit = fw_unit_get(unit);
mutex_init(&efw->mutex);
spin_lock_init(&efw->lock);
init_waitqueue_head(&efw->hwdep_wait);
Expand Down Expand Up @@ -289,10 +300,7 @@ static void efw_remove(struct fw_unit *unit)
{
struct snd_efw *efw = dev_get_drvdata(&unit->device);

snd_efw_stream_destroy_duplex(efw);
snd_efw_transaction_remove_instance(efw);

snd_card_disconnect(efw->card);
/* No need to wait for releasing card object in this context. */
snd_card_free_when_closed(efw->card);
}

Expand Down
19 changes: 10 additions & 9 deletions sound/firewire/fireworks/fireworks_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,22 @@ start_stream(struct snd_efw *efw, struct amdtp_stream *stream,
return err;
}

/*
* This function should be called before starting the stream or after stopping
* the streams.
*/
static void
destroy_stream(struct snd_efw *efw, struct amdtp_stream *stream)
{
stop_stream(efw, stream);

amdtp_stream_destroy(stream);
struct cmp_connection *conn;

if (stream == &efw->tx_stream)
cmp_connection_destroy(&efw->out_conn);
conn = &efw->out_conn;
else
cmp_connection_destroy(&efw->in_conn);
conn = &efw->in_conn;

amdtp_stream_destroy(stream);
cmp_connection_destroy(&efw->out_conn);
}

static int
Expand Down Expand Up @@ -319,12 +324,8 @@ void snd_efw_stream_update_duplex(struct snd_efw *efw)

void snd_efw_stream_destroy_duplex(struct snd_efw *efw)
{
mutex_lock(&efw->mutex);

destroy_stream(efw, &efw->rx_stream);
destroy_stream(efw, &efw->tx_stream);

mutex_unlock(&efw->mutex);
}

void snd_efw_stream_lock_changed(struct snd_efw *efw)
Expand Down
6 changes: 4 additions & 2 deletions sound/firewire/oxfw/oxfw-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,10 @@ void snd_oxfw_stream_stop_simplex(struct snd_oxfw *oxfw,
stop_stream(oxfw, stream);
}

/*
* This function should be called before starting the stream or after stopping
* the streams.
*/
void snd_oxfw_stream_destroy_simplex(struct snd_oxfw *oxfw,
struct amdtp_stream *stream)
{
Expand All @@ -347,8 +351,6 @@ void snd_oxfw_stream_destroy_simplex(struct snd_oxfw *oxfw,
else
conn = &oxfw->in_conn;

stop_stream(oxfw, stream);

amdtp_stream_destroy(stream);
cmp_connection_destroy(conn);
}
Expand Down
21 changes: 14 additions & 7 deletions sound/firewire/oxfw/oxfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,23 @@ static int name_card(struct snd_oxfw *oxfw)
return err;
}

/*
* This module releases the FireWire unit data after all ALSA character devices
* are released by applications. This is for releasing stream data or finishing
* transactions safely. Thus at returning from .remove(), this module still keep
* references for the unit.
*/
static void oxfw_card_free(struct snd_card *card)
{
struct snd_oxfw *oxfw = card->private_data;
unsigned int i;

snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream);
if (oxfw->has_output)
snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream);

fw_unit_put(oxfw->unit);

for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) {
kfree(oxfw->tx_stream_formats[i]);
kfree(oxfw->rx_stream_formats[i]);
Expand Down Expand Up @@ -136,7 +148,7 @@ static int oxfw_probe(struct fw_unit *unit,
oxfw = card->private_data;
oxfw->card = card;
mutex_init(&oxfw->mutex);
oxfw->unit = unit;
oxfw->unit = fw_unit_get(unit);
oxfw->device_info = (const struct device_info *)id->driver_data;
spin_lock_init(&oxfw->lock);
init_waitqueue_head(&oxfw->hwdep_wait);
Expand Down Expand Up @@ -212,12 +224,7 @@ static void oxfw_remove(struct fw_unit *unit)
{
struct snd_oxfw *oxfw = dev_get_drvdata(&unit->device);

snd_card_disconnect(oxfw->card);

snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream);
if (oxfw->has_output)
snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream);

/* No need to wait for releasing card object in this context. */
snd_card_free_when_closed(oxfw->card);
}

Expand Down
Loading

0 comments on commit b5731f4

Please sign in to comment.