ALSA: sc6000: Assign vport directly on card's private_data
sc6000 driver tries to allocate an extra pointer for keeping the vport address and point it over card->private_data. But, this indirect access is utterly superfluous, and we can keep the vport address directly in card->private_data instead. This will simply the code and avoid confusion. Link: https://lore.kernel.org/r/20210720162837.6026-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
dca18a94d3
commit
9b7843d1e1
|
@ -531,10 +531,10 @@ static int snd_sc6000_match(struct device *devptr, unsigned int dev)
|
||||||
|
|
||||||
static void snd_sc6000_free(struct snd_card *card)
|
static void snd_sc6000_free(struct snd_card *card)
|
||||||
{
|
{
|
||||||
char __iomem **vport = card->private_data;
|
char __iomem *vport = card->private_data;
|
||||||
|
|
||||||
if (*vport)
|
if (vport)
|
||||||
sc6000_setup_board(*vport, 0);
|
sc6000_setup_board(vport, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_sc6000_probe(struct device *devptr, unsigned int dev)
|
static int snd_sc6000_probe(struct device *devptr, unsigned int dev)
|
||||||
|
@ -547,16 +547,14 @@ static int snd_sc6000_probe(struct device *devptr, unsigned int dev)
|
||||||
struct snd_card *card;
|
struct snd_card *card;
|
||||||
struct snd_wss *chip;
|
struct snd_wss *chip;
|
||||||
struct snd_opl3 *opl3;
|
struct snd_opl3 *opl3;
|
||||||
char __iomem **vport;
|
char __iomem *vport;
|
||||||
char __iomem *vmss_port;
|
char __iomem *vmss_port;
|
||||||
|
|
||||||
|
|
||||||
err = snd_devm_card_new(devptr, index[dev], id[dev], THIS_MODULE,
|
err = snd_devm_card_new(devptr, index[dev], id[dev], THIS_MODULE,
|
||||||
sizeof(*vport), &card);
|
0, &card);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
vport = card->private_data;
|
|
||||||
if (xirq == SNDRV_AUTO_IRQ) {
|
if (xirq == SNDRV_AUTO_IRQ) {
|
||||||
xirq = snd_legacy_find_free_irq(possible_irqs);
|
xirq = snd_legacy_find_free_irq(possible_irqs);
|
||||||
if (xirq < 0) {
|
if (xirq < 0) {
|
||||||
|
@ -578,12 +576,13 @@ static int snd_sc6000_probe(struct device *devptr, unsigned int dev)
|
||||||
"I/O port region is already in use.\n");
|
"I/O port region is already in use.\n");
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
*vport = devm_ioport_map(devptr, port[dev], 0x10);
|
vport = devm_ioport_map(devptr, port[dev], 0x10);
|
||||||
if (*vport == NULL) {
|
if (!vport) {
|
||||||
snd_printk(KERN_ERR PFX
|
snd_printk(KERN_ERR PFX
|
||||||
"I/O port cannot be iomapped.\n");
|
"I/O port cannot be iomapped.\n");
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
card->private_data = vport;
|
||||||
|
|
||||||
/* to make it marked as used */
|
/* to make it marked as used */
|
||||||
if (!devm_request_region(devptr, mss_port[dev], 4, DRV_NAME)) {
|
if (!devm_request_region(devptr, mss_port[dev], 4, DRV_NAME)) {
|
||||||
|
@ -602,7 +601,7 @@ static int snd_sc6000_probe(struct device *devptr, unsigned int dev)
|
||||||
port[dev], xirq, xdma,
|
port[dev], xirq, xdma,
|
||||||
mpu_irq[dev] == SNDRV_AUTO_IRQ ? 0 : mpu_irq[dev]);
|
mpu_irq[dev] == SNDRV_AUTO_IRQ ? 0 : mpu_irq[dev]);
|
||||||
|
|
||||||
err = sc6000_init_board(*vport, vmss_port, dev);
|
err = sc6000_init_board(vport, vmss_port, dev);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
card->private_free = snd_sc6000_free;
|
card->private_free = snd_sc6000_free;
|
||||||
|
|
Loading…
Reference in New Issue