IEEE 1394 (FireWire) subsystem changes post v3.10:

Make struct ieee1394_device_id.driver_data actually avaliable to
 1394 protocol drivers.  This is especially useful to 1394 audio drivers
 for model-specific parameters and methods.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.20 (GNU/Linux)
 
 iQIcBAABAgAGBQJR2Sb3AAoJEHnzb7JUXXnQqqcQAOY/01VNTih1BuTnuDDtKQdq
 DQ9aO7zBc/aFY0baImrmbaZ7KUlwKKrFNaQMI63gj/ESyGIK6njRgPIS2I0eQSL1
 Wb+4FXsOqtyXlRnL2eCHOl0o5ZrVyZD/ZDpBh+AxTl7nZYM5hX1ARDSeRX4SD/og
 KWTrSV6GtTijJaTGLQ+d5AY5QndT754LvgRcqVStsL2/pt3aeCpuIEAo6osXrD7u
 IsaJS7FSmrNnOKQFA7JFJVvBLyF+xxjNW/XQAnZ5NGbLOmB9jnyCKjOk9YE97/Sb
 qAacO3FEo7GUT5qksV/awuaGZpIfWEVCb9oD3heui1F0XSxrPUq8RXTJHa/g/BK7
 q2feV1lv9ZAJWjLTePlB4TNgym+oVr1OqhsspHnM7mHhALKZwbDmDusxkFK8EH7P
 v7WNBwyik03qY3A6mgbTxUKcmiem9maCcyE1acPnHFqch0QafILwK6qPQb1oMG5Y
 BDdRNCXxNLGMasRsMDvKabHhs1u+KZ4/qUwooKdLbRL/WJuRHVU+UveTQ2f+90HY
 0UEgplUfphrX9QyWqm7NHxwxVW83NnihcgkDgdVw77ARblJDYB5nLyqS1eIYF6xa
 59h0b3DDM7SaaGVS9niOuwz9p8ZdXNY2VKn+byA5zyy/xNB06KVXlDydEXV2G7mv
 HZqMzX54d6zdf51v/UgT
 =8MqX
 -----END PGP SIGNATURE-----

Merge tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394

Pull firewire updates from Stefan Richter:
 "Make struct ieee1394_device_id.driver_data actually avaliable to 1394
  protocol drivers.  This is especially useful to 1394 audio drivers for
  model-specific parameters and methods"

* tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394:
  firewire: remove support of fw_driver.driver.probe and .remove methods
  firewire: introduce fw_driver.probe and .remove methods
This commit is contained in:
Linus Torvalds 2013-07-10 11:02:58 -07:00
commit bb93109e15
9 changed files with 160 additions and 170 deletions

View file

@ -626,9 +626,9 @@ static u64 get_unit_base(struct fw_unit *unit)
return 0;
}
static int isight_probe(struct device *unit_dev)
static int isight_probe(struct fw_unit *unit,
const struct ieee1394_device_id *id)
{
struct fw_unit *unit = fw_unit(unit_dev);
struct fw_device *fw_dev = fw_parent_device(unit);
struct snd_card *card;
struct isight *isight;
@ -637,7 +637,7 @@ static int isight_probe(struct device *unit_dev)
err = snd_card_create(-1, NULL, THIS_MODULE, sizeof(*isight), &card);
if (err < 0)
return err;
snd_card_set_dev(card, unit_dev);
snd_card_set_dev(card, &unit->device);
isight = card->private_data;
isight->card = card;
@ -674,7 +674,7 @@ static int isight_probe(struct device *unit_dev)
if (err < 0)
goto error;
dev_set_drvdata(unit_dev, isight);
dev_set_drvdata(&unit->device, isight);
return 0;
@ -686,23 +686,6 @@ error:
return err;
}
static int isight_remove(struct device *dev)
{
struct isight *isight = dev_get_drvdata(dev);
isight_pcm_abort(isight);
snd_card_disconnect(isight->card);
mutex_lock(&isight->mutex);
isight_stop_streaming(isight);
mutex_unlock(&isight->mutex);
snd_card_free_when_closed(isight->card);
return 0;
}
static void isight_bus_reset(struct fw_unit *unit)
{
struct isight *isight = dev_get_drvdata(&unit->device);
@ -716,6 +699,21 @@ static void isight_bus_reset(struct fw_unit *unit)
}
}
static void isight_remove(struct fw_unit *unit)
{
struct isight *isight = dev_get_drvdata(&unit->device);
isight_pcm_abort(isight);
snd_card_disconnect(isight->card);
mutex_lock(&isight->mutex);
isight_stop_streaming(isight);
mutex_unlock(&isight->mutex);
snd_card_free_when_closed(isight->card);
}
static const struct ieee1394_device_id isight_id_table[] = {
{
.match_flags = IEEE1394_MATCH_SPECIFIER_ID |
@ -732,10 +730,10 @@ static struct fw_driver isight_driver = {
.owner = THIS_MODULE,
.name = KBUILD_MODNAME,
.bus = &fw_bus_type,
.probe = isight_probe,
.remove = isight_remove,
},
.probe = isight_probe,
.update = isight_bus_reset,
.remove = isight_remove,
.id_table = isight_id_table,
};

View file

@ -384,9 +384,8 @@ static void scs_card_free(struct snd_card *card)
kfree(scs->buffer);
}
static int scs_probe(struct device *unit_dev)
static int scs_probe(struct fw_unit *unit, const struct ieee1394_device_id *id)
{
struct fw_unit *unit = fw_unit(unit_dev);
struct fw_device *fw_dev = fw_parent_device(unit);
struct snd_card *card;
struct scs *scs;
@ -395,7 +394,7 @@ static int scs_probe(struct device *unit_dev)
err = snd_card_create(-16, NULL, THIS_MODULE, sizeof(*scs), &card);
if (err < 0)
return err;
snd_card_set_dev(card, unit_dev);
snd_card_set_dev(card, &unit->device);
scs = card->private_data;
scs->card = card;
@ -442,7 +441,7 @@ static int scs_probe(struct device *unit_dev)
if (err < 0)
goto err_card;
dev_set_drvdata(unit_dev, scs);
dev_set_drvdata(&unit->device, scs);
return 0;
@ -453,24 +452,6 @@ err_card:
return err;
}
static int scs_remove(struct device *dev)
{
struct scs *scs = dev_get_drvdata(dev);
snd_card_disconnect(scs->card);
ACCESS_ONCE(scs->output) = NULL;
ACCESS_ONCE(scs->input) = NULL;
wait_event(scs->idle_wait, scs->output_idle);
tasklet_kill(&scs->tasklet);
snd_card_free_when_closed(scs->card);
return 0;
}
static void scs_update(struct fw_unit *unit)
{
struct scs *scs = dev_get_drvdata(&unit->device);
@ -482,6 +463,22 @@ static void scs_update(struct fw_unit *unit)
HSS1394_ADDRESS, &data, 8);
}
static void scs_remove(struct fw_unit *unit)
{
struct scs *scs = dev_get_drvdata(&unit->device);
snd_card_disconnect(scs->card);
ACCESS_ONCE(scs->output) = NULL;
ACCESS_ONCE(scs->input) = NULL;
wait_event(scs->idle_wait, scs->output_idle);
tasklet_kill(&scs->tasklet);
snd_card_free_when_closed(scs->card);
}
static const struct ieee1394_device_id scs_id_table[] = {
{
.match_flags = IEEE1394_MATCH_VENDOR_ID |
@ -508,10 +505,10 @@ static struct fw_driver scs_driver = {
.owner = THIS_MODULE,
.name = KBUILD_MODNAME,
.bus = &fw_bus_type,
.probe = scs_probe,
.remove = scs_remove,
},
.probe = scs_probe,
.update = scs_update,
.remove = scs_remove,
.id_table = scs_id_table,
};

View file

@ -663,45 +663,9 @@ static void fwspk_card_free(struct snd_card *card)
mutex_destroy(&fwspk->mutex);
}
static const struct device_info *fwspk_detect(struct fw_device *dev)
static int fwspk_probe(struct fw_unit *unit,
const struct ieee1394_device_id *id)
{
static const struct device_info griffin_firewave = {
.driver_name = "FireWave",
.short_name = "FireWave",
.long_name = "Griffin FireWave Surround",
.pcm_constraints = firewave_constraints,
.mixer_channels = 6,
.mute_fb_id = 0x01,
.volume_fb_id = 0x02,
};
static const struct device_info lacie_speakers = {
.driver_name = "FWSpeakers",
.short_name = "FireWire Speakers",
.long_name = "LaCie FireWire Speakers",
.pcm_constraints = lacie_speakers_constraints,
.mixer_channels = 1,
.mute_fb_id = 0x01,
.volume_fb_id = 0x01,
};
struct fw_csr_iterator i;
int key, value;
fw_csr_iterator_init(&i, dev->config_rom);
while (fw_csr_iterator_next(&i, &key, &value))
if (key == CSR_VENDOR)
switch (value) {
case VENDOR_GRIFFIN:
return &griffin_firewave;
case VENDOR_LACIE:
return &lacie_speakers;
}
return NULL;
}
static int fwspk_probe(struct device *unit_dev)
{
struct fw_unit *unit = fw_unit(unit_dev);
struct fw_device *fw_dev = fw_parent_device(unit);
struct snd_card *card;
struct fwspk *fwspk;
@ -711,17 +675,13 @@ static int fwspk_probe(struct device *unit_dev)
err = snd_card_create(-1, NULL, THIS_MODULE, sizeof(*fwspk), &card);
if (err < 0)
return err;
snd_card_set_dev(card, unit_dev);
snd_card_set_dev(card, &unit->device);
fwspk = card->private_data;
fwspk->card = card;
mutex_init(&fwspk->mutex);
fwspk->unit = fw_unit_get(unit);
fwspk->device_info = fwspk_detect(fw_dev);
if (!fwspk->device_info) {
err = -ENODEV;
goto err_unit;
}
fwspk->device_info = (const struct device_info *)id->driver_data;
err = cmp_connection_init(&fwspk->connection, unit, 0);
if (err < 0)
@ -756,7 +716,7 @@ static int fwspk_probe(struct device *unit_dev)
if (err < 0)
goto error;
dev_set_drvdata(unit_dev, fwspk);
dev_set_drvdata(&unit->device, fwspk);
return 0;
@ -770,22 +730,6 @@ error:
return err;
}
static int fwspk_remove(struct device *dev)
{
struct fwspk *fwspk = dev_get_drvdata(dev);
amdtp_out_stream_pcm_abort(&fwspk->stream);
snd_card_disconnect(fwspk->card);
mutex_lock(&fwspk->mutex);
fwspk_stop_stream(fwspk);
mutex_unlock(&fwspk->mutex);
snd_card_free_when_closed(fwspk->card);
return 0;
}
static void fwspk_bus_reset(struct fw_unit *unit)
{
struct fwspk *fwspk = dev_get_drvdata(&unit->device);
@ -803,6 +747,40 @@ static void fwspk_bus_reset(struct fw_unit *unit)
amdtp_out_stream_update(&fwspk->stream);
}
static void fwspk_remove(struct fw_unit *unit)
{
struct fwspk *fwspk = dev_get_drvdata(&unit->device);
amdtp_out_stream_pcm_abort(&fwspk->stream);
snd_card_disconnect(fwspk->card);
mutex_lock(&fwspk->mutex);
fwspk_stop_stream(fwspk);
mutex_unlock(&fwspk->mutex);
snd_card_free_when_closed(fwspk->card);
}
static const struct device_info griffin_firewave = {
.driver_name = "FireWave",
.short_name = "FireWave",
.long_name = "Griffin FireWave Surround",
.pcm_constraints = firewave_constraints,
.mixer_channels = 6,
.mute_fb_id = 0x01,
.volume_fb_id = 0x02,
};
static const struct device_info lacie_speakers = {
.driver_name = "FWSpeakers",
.short_name = "FireWire Speakers",
.long_name = "LaCie FireWire Speakers",
.pcm_constraints = lacie_speakers_constraints,
.mixer_channels = 1,
.mute_fb_id = 0x01,
.volume_fb_id = 0x01,
};
static const struct ieee1394_device_id fwspk_id_table[] = {
{
.match_flags = IEEE1394_MATCH_VENDOR_ID |
@ -813,6 +791,7 @@ static const struct ieee1394_device_id fwspk_id_table[] = {
.model_id = 0x00f970,
.specifier_id = SPECIFIER_1394TA,
.version = VERSION_AVC,
.driver_data = (kernel_ulong_t)&griffin_firewave,
},
{
.match_flags = IEEE1394_MATCH_VENDOR_ID |
@ -823,6 +802,7 @@ static const struct ieee1394_device_id fwspk_id_table[] = {
.model_id = 0x00f970,
.specifier_id = SPECIFIER_1394TA,
.version = VERSION_AVC,
.driver_data = (kernel_ulong_t)&lacie_speakers,
},
{ }
};
@ -833,10 +813,10 @@ static struct fw_driver fwspk_driver = {
.owner = THIS_MODULE,
.name = KBUILD_MODNAME,
.bus = &fw_bus_type,
.probe = fwspk_probe,
.remove = fwspk_remove,
},
.probe = fwspk_probe,
.update = fwspk_bus_reset,
.remove = fwspk_remove,
.id_table = fwspk_id_table,
};