diff options
Diffstat (limited to 'sound/sparc')
| -rw-r--r-- | sound/sparc/amd7930.c | 34 | ||||
| -rw-r--r-- | sound/sparc/cs4231.c | 81 | ||||
| -rw-r--r-- | sound/sparc/dbri.c | 57 | 
3 files changed, 78 insertions, 94 deletions
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c index f8bcfc30f80..4a85e143347 100644 --- a/sound/sparc/amd7930.c +++ b/sound/sparc/amd7930.c @@ -50,7 +50,7 @@  static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */  static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */  module_param_array(index, int, NULL, 0444);  MODULE_PARM_DESC(index, "Index value for Sun AMD7930 soundcard."); @@ -755,7 +755,7 @@ static struct snd_pcm_ops snd_amd7930_capture_ops = {  	.pointer	=	snd_amd7930_capture_pointer,  }; -static int __devinit snd_amd7930_pcm(struct snd_amd7930 *amd) +static int snd_amd7930_pcm(struct snd_amd7930 *amd)  {  	struct snd_pcm *pcm;  	int err; @@ -813,7 +813,7 @@ static int snd_amd7930_get_volume(struct snd_kcontrol *kctl, struct snd_ctl_elem  	default:  		swval = &amd->pgain;  		break; -	}; +	}  	ucontrol->value.integer.value[0] = *swval; @@ -838,7 +838,7 @@ static int snd_amd7930_put_volume(struct snd_kcontrol *kctl, struct snd_ctl_elem  	default:  		swval = &amd->pgain;  		break; -	}; +	}  	spin_lock_irqsave(&amd->lock, flags); @@ -854,7 +854,7 @@ static int snd_amd7930_put_volume(struct snd_kcontrol *kctl, struct snd_ctl_elem  	return change;  } -static struct snd_kcontrol_new amd7930_controls[] __devinitdata = { +static struct snd_kcontrol_new amd7930_controls[] = {  	{  		.iface		=	SNDRV_CTL_ELEM_IFACE_MIXER,  		.name		=	"Monitor Volume", @@ -884,7 +884,7 @@ static struct snd_kcontrol_new amd7930_controls[] __devinitdata = {  	},  }; -static int __devinit snd_amd7930_mixer(struct snd_amd7930 *amd) +static int snd_amd7930_mixer(struct snd_amd7930 *amd)  {  	struct snd_card *card;  	int idx, err; @@ -933,10 +933,10 @@ static struct snd_device_ops snd_amd7930_dev_ops = {  	.dev_free	=	snd_amd7930_dev_free,  }; -static int __devinit snd_amd7930_create(struct snd_card *card, -					struct platform_device *op, -					int irq, int dev, -					struct snd_amd7930 **ramd) +static int snd_amd7930_create(struct snd_card *card, +			      struct platform_device *op, +			      int irq, int dev, +			      struct snd_amd7930 **ramd)  {  	struct snd_amd7930 *amd;  	unsigned long flags; @@ -962,7 +962,7 @@ static int __devinit snd_amd7930_create(struct snd_card *card,  	amd7930_idle(amd);  	if (request_irq(irq, snd_amd7930_interrupt, -			IRQF_DISABLED | IRQF_SHARED, "amd7930", amd)) { +			IRQF_SHARED, "amd7930", amd)) {  		snd_printk(KERN_ERR "amd7930-%d: Unable to grab IRQ %d\n",  			   dev, irq);  		snd_amd7930_free(amd); @@ -1002,7 +1002,7 @@ static int __devinit snd_amd7930_create(struct snd_card *card,  	return 0;  } -static int __devinit amd7930_sbus_probe(struct platform_device *op, const struct of_device_id *match) +static int amd7930_sbus_probe(struct platform_device *op)  {  	struct resource *rp = &op->resource[0];  	static int dev_num; @@ -1019,8 +1019,8 @@ static int __devinit amd7930_sbus_probe(struct platform_device *op, const struct  		return -ENOENT;  	} -	err = snd_card_create(index[dev_num], id[dev_num], THIS_MODULE, 0, -			      &card); +	err = snd_card_new(&op->dev, index[dev_num], id[dev_num], +			   THIS_MODULE, 0, &card);  	if (err < 0)  		return err; @@ -1064,7 +1064,7 @@ static const struct of_device_id amd7930_match[] = {  	{},  }; -static struct of_platform_driver amd7930_sbus_driver = { +static struct platform_driver amd7930_sbus_driver = {  	.driver = {  		.name = "audio",  		.owner = THIS_MODULE, @@ -1075,7 +1075,7 @@ static struct of_platform_driver amd7930_sbus_driver = {  static int __init amd7930_init(void)  { -	return of_register_platform_driver(&amd7930_sbus_driver); +	return platform_driver_register(&amd7930_sbus_driver);  }  static void __exit amd7930_exit(void) @@ -1092,7 +1092,7 @@ static void __exit amd7930_exit(void)  	amd7930_list = NULL; -	of_unregister_platform_driver(&amd7930_sbus_driver); +	platform_driver_unregister(&amd7930_sbus_driver);  }  module_init(amd7930_init); diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index c276086c3b5..4e91bcaa366 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c @@ -40,7 +40,7 @@  static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */  static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */  /* Enable this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;  module_param_array(index, int, NULL, 0444);  MODULE_PARM_DESC(index, "Index value for Sun CS4231 soundcard."); @@ -429,7 +429,8 @@ static void snd_cs4231_advance_dma(struct cs4231_dma_control *dma_cont,  		unsigned int period_size = snd_pcm_lib_period_bytes(substream);  		unsigned int offset = period_size * (*periods_sent); -		BUG_ON(period_size >= (1 << 24)); +		if (WARN_ON(period_size >= (1 << 24))) +			return;  		if (dma_cont->request(dma_cont,  				      runtime->dma_addr + offset, period_size)) @@ -702,7 +703,7 @@ static int snd_cs4231_timer_stop(struct snd_timer *timer)  	return 0;  } -static void __devinit snd_cs4231_init(struct snd_cs4231 *chip) +static void snd_cs4231_init(struct snd_cs4231 *chip)  {  	unsigned long flags; @@ -906,18 +907,24 @@ static int snd_cs4231_playback_prepare(struct snd_pcm_substream *substream)  	struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);  	struct snd_pcm_runtime *runtime = substream->runtime;  	unsigned long flags; +	int ret = 0;  	spin_lock_irqsave(&chip->lock, flags);  	chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE |  					    CS4231_PLAYBACK_PIO); -	BUG_ON(runtime->period_size > 0xffff + 1); +	if (WARN_ON(runtime->period_size > 0xffff + 1)) { +		ret = -EINVAL; +		goto out; +	}  	chip->p_periods_sent = 0; + +out:  	spin_unlock_irqrestore(&chip->lock, flags); -	return 0; +	return ret;  }  static int snd_cs4231_capture_hw_params(struct snd_pcm_substream *substream, @@ -1019,7 +1026,7 @@ static snd_pcm_uframes_t snd_cs4231_capture_pointer(  	return bytes_to_frames(substream->runtime, ptr);  } -static int __devinit snd_cs4231_probe(struct snd_cs4231 *chip) +static int snd_cs4231_probe(struct snd_cs4231 *chip)  {  	unsigned long flags;  	int i; @@ -1218,7 +1225,7 @@ static struct snd_pcm_ops snd_cs4231_capture_ops = {  	.pointer	=	snd_cs4231_capture_pointer,  }; -static int __devinit snd_cs4231_pcm(struct snd_card *card) +static int snd_cs4231_pcm(struct snd_card *card)  {  	struct snd_cs4231 *chip = card->private_data;  	struct snd_pcm *pcm; @@ -1247,7 +1254,7 @@ static int __devinit snd_cs4231_pcm(struct snd_card *card)  	return 0;  } -static int __devinit snd_cs4231_timer(struct snd_card *card) +static int snd_cs4231_timer(struct snd_card *card)  {  	struct snd_cs4231 *chip = card->private_data;  	struct snd_timer *timer; @@ -1498,7 +1505,7 @@ static int snd_cs4231_put_double(struct snd_kcontrol *kcontrol,    .private_value = (left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | \  		   ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22) } -static struct snd_kcontrol_new snd_cs4231_controls[] __devinitdata = { +static struct snd_kcontrol_new snd_cs4231_controls[] = {  CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT,  		CS4231_RIGHT_OUTPUT, 7, 7, 1, 1),  CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT, @@ -1537,7 +1544,7 @@ CS4231_SINGLE("Line Out Switch", 0, CS4231_PIN_CTRL, 6, 1, 1),  CS4231_SINGLE("Headphone Out Switch", 0, CS4231_PIN_CTRL, 7, 1, 1)  }; -static int __devinit snd_cs4231_mixer(struct snd_card *card) +static int snd_cs4231_mixer(struct snd_card *card)  {  	struct snd_cs4231 *chip = card->private_data;  	int err, idx; @@ -1558,7 +1565,8 @@ static int __devinit snd_cs4231_mixer(struct snd_card *card)  static int dev; -static int __devinit cs4231_attach_begin(struct snd_card **rcard) +static int cs4231_attach_begin(struct platform_device *op, +			       struct snd_card **rcard)  {  	struct snd_card *card;  	struct snd_cs4231 *chip; @@ -1574,8 +1582,8 @@ static int __devinit cs4231_attach_begin(struct snd_card **rcard)  		return -ENOENT;  	} -	err = snd_card_create(index[dev], id[dev], THIS_MODULE, -			      sizeof(struct snd_cs4231), &card); +	err = snd_card_new(&op->dev, index[dev], id[dev], THIS_MODULE, +			   sizeof(struct snd_cs4231), &card);  	if (err < 0)  		return err; @@ -1589,7 +1597,7 @@ static int __devinit cs4231_attach_begin(struct snd_card **rcard)  	return 0;  } -static int __devinit cs4231_attach_finish(struct snd_card *card) +static int cs4231_attach_finish(struct snd_card *card)  {  	struct snd_cs4231 *chip = card->private_data;  	int err; @@ -1793,9 +1801,9 @@ static struct snd_device_ops snd_cs4231_sbus_dev_ops = {  	.dev_free	=	snd_cs4231_sbus_dev_free,  }; -static int __devinit snd_cs4231_sbus_create(struct snd_card *card, -					    struct platform_device *op, -					    int dev) +static int snd_cs4231_sbus_create(struct snd_card *card, +				  struct platform_device *op, +				  int dev)  {  	struct snd_cs4231 *chip = card->private_data;  	int err; @@ -1856,13 +1864,13 @@ static int __devinit snd_cs4231_sbus_create(struct snd_card *card,  	return 0;  } -static int __devinit cs4231_sbus_probe(struct platform_device *op, const struct of_device_id *match) +static int cs4231_sbus_probe(struct platform_device *op)  {  	struct resource *rp = &op->resource[0];  	struct snd_card *card;  	int err; -	err = cs4231_attach_begin(&card); +	err = cs4231_attach_begin(op, &card);  	if (err)  		return err; @@ -1959,9 +1967,9 @@ static struct snd_device_ops snd_cs4231_ebus_dev_ops = {  	.dev_free	=	snd_cs4231_ebus_dev_free,  }; -static int __devinit snd_cs4231_ebus_create(struct snd_card *card, -					    struct platform_device *op, -					    int dev) +static int snd_cs4231_ebus_create(struct snd_card *card, +				  struct platform_device *op, +				  int dev)  {  	struct snd_cs4231 *chip = card->private_data;  	int err; @@ -2048,12 +2056,12 @@ static int __devinit snd_cs4231_ebus_create(struct snd_card *card,  	return 0;  } -static int __devinit cs4231_ebus_probe(struct platform_device *op, const struct of_device_id *match) +static int cs4231_ebus_probe(struct platform_device *op)  {  	struct snd_card *card;  	int err; -	err = cs4231_attach_begin(&card); +	err = cs4231_attach_begin(op, &card);  	if (err)  		return err; @@ -2072,21 +2080,21 @@ static int __devinit cs4231_ebus_probe(struct platform_device *op, const struct  }  #endif -static int __devinit cs4231_probe(struct platform_device *op, const struct of_device_id *match) +static int cs4231_probe(struct platform_device *op)  {  #ifdef EBUS_SUPPORT  	if (!strcmp(op->dev.of_node->parent->name, "ebus")) -		return cs4231_ebus_probe(op, match); +		return cs4231_ebus_probe(op);  #endif  #ifdef SBUS_SUPPORT  	if (!strcmp(op->dev.of_node->parent->name, "sbus") ||  	    !strcmp(op->dev.of_node->parent->name, "sbi")) -		return cs4231_sbus_probe(op, match); +		return cs4231_sbus_probe(op);  #endif  	return -ENODEV;  } -static int __devexit cs4231_remove(struct platform_device *op) +static int cs4231_remove(struct platform_device *op)  {  	struct snd_cs4231 *chip = dev_get_drvdata(&op->dev); @@ -2108,25 +2116,14 @@ static const struct of_device_id cs4231_match[] = {  MODULE_DEVICE_TABLE(of, cs4231_match); -static struct of_platform_driver cs4231_driver = { +static struct platform_driver cs4231_driver = {  	.driver = {  		.name = "audio",  		.owner = THIS_MODULE,  		.of_match_table = cs4231_match,  	},  	.probe		= cs4231_probe, -	.remove		= __devexit_p(cs4231_remove), +	.remove		= cs4231_remove,  }; -static int __init cs4231_init(void) -{ -	return of_register_platform_driver(&cs4231_driver); -} - -static void __exit cs4231_exit(void) -{ -	of_unregister_platform_driver(&cs4231_driver); -} - -module_init(cs4231_init); -module_exit(cs4231_exit); +module_platform_driver(cs4231_driver); diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index 39cd5d69d05..be1b1aa96b7 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c @@ -69,7 +69,8 @@  #include <linux/of.h>  #include <linux/of_device.h> -#include <asm/atomic.h> +#include <linux/atomic.h> +#include <linux/module.h>  MODULE_AUTHOR("Rudolf Koenig, Brent Baccala and Martin Habets");  MODULE_DESCRIPTION("Sun DBRI"); @@ -79,7 +80,7 @@ MODULE_SUPPORTED_DEVICE("{{Sun,DBRI}}");  static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */  static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */  /* Enable this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;  module_param_array(index, int, NULL, 0444);  MODULE_PARM_DESC(index, "Index value for Sun DBRI soundcard."); @@ -591,7 +592,7 @@ static __u32 reverse_bytes(__u32 b, int len)  		break;  	default:  		printk(KERN_ERR "DBRI reverse_bytes: unsupported length\n"); -	}; +	}  	return b;  } @@ -744,7 +745,7 @@ static void dbri_reset(struct snd_dbri *dbri)  }  /* Lock must not be held before calling this */ -static void __devinit dbri_initialize(struct snd_dbri *dbri) +static void dbri_initialize(struct snd_dbri *dbri)  {  	s32 *cmd;  	u32 dma_addr; @@ -1304,7 +1305,7 @@ to the DBRI via the CHI interface and few of the DBRI's PIO pins.   * Lock must not be held before calling it.  */ -static __devinit void cs4215_setup_pipes(struct snd_dbri *dbri) +static void cs4215_setup_pipes(struct snd_dbri *dbri)  {  	unsigned long flags; @@ -1337,7 +1338,7 @@ static __devinit void cs4215_setup_pipes(struct snd_dbri *dbri)  	dbri_cmdwait(dbri);  } -static __devinit int cs4215_init_data(struct cs4215 *mm) +static int cs4215_init_data(struct cs4215 *mm)  {  	/*  	 * No action, memory resetting only. @@ -1629,7 +1630,7 @@ static int cs4215_prepare(struct snd_dbri *dbri, unsigned int rate,  /*   *   */ -static __devinit int cs4215_init(struct snd_dbri *dbri) +static int cs4215_init(struct snd_dbri *dbri)  {  	u32 reg2 = sbus_readl(dbri->regs + REG2);  	dprintk(D_MM, "cs4215_init: reg2=0x%x\n", reg2); @@ -2216,7 +2217,7 @@ static struct snd_pcm_ops snd_dbri_ops = {  	.pointer = snd_dbri_pointer,  }; -static int __devinit snd_dbri_pcm(struct snd_card *card) +static int snd_dbri_pcm(struct snd_card *card)  {  	struct snd_pcm *pcm;  	int err; @@ -2408,7 +2409,7 @@ static int snd_cs4215_put_single(struct snd_kcontrol *kcontrol,    .private_value = (entry) | ((shift) << 8) | ((mask) << 16) |	\  			((invert) << 24) }, -static struct snd_kcontrol_new dbri_controls[] __devinitdata = { +static struct snd_kcontrol_new dbri_controls[] = {  	{  	 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,  	 .name  = "Playback Volume", @@ -2435,7 +2436,7 @@ static struct snd_kcontrol_new dbri_controls[] __devinitdata = {  	CS4215_SINGLE("Mic boost", 4, 4, 1, 1)  }; -static int __devinit snd_dbri_mixer(struct snd_card *card) +static int snd_dbri_mixer(struct snd_card *card)  {  	int idx, err;  	struct snd_dbri *dbri; @@ -2499,7 +2500,7 @@ static void dbri_debug_read(struct snd_info_entry *entry,  }  #endif -static void __devinit snd_dbri_proc(struct snd_card *card) +static void snd_dbri_proc(struct snd_card *card)  {  	struct snd_dbri *dbri = card->private_data;  	struct snd_info_entry *entry; @@ -2522,9 +2523,9 @@ static void __devinit snd_dbri_proc(struct snd_card *card)  */  static void snd_dbri_free(struct snd_dbri *dbri); -static int __devinit snd_dbri_create(struct snd_card *card, -				     struct platform_device *op, -				     int irq, int dev) +static int snd_dbri_create(struct snd_card *card, +			   struct platform_device *op, +			   int irq, int dev)  {  	struct snd_dbri *dbri = card->private_data;  	int err; @@ -2592,7 +2593,7 @@ static void snd_dbri_free(struct snd_dbri *dbri)  				  (void *)dbri->dma, dbri->dma_dvma);  } -static int __devinit dbri_probe(struct platform_device *op, const struct of_device_id *match) +static int dbri_probe(struct platform_device *op)  {  	struct snd_dbri *dbri;  	struct resource *rp; @@ -2614,8 +2615,8 @@ static int __devinit dbri_probe(struct platform_device *op, const struct of_devi  		return -ENODEV;  	} -	err = snd_card_create(index[dev], id[dev], THIS_MODULE, -			      sizeof(struct snd_dbri), &card); +	err = snd_card_new(&op->dev, index[dev], id[dev], THIS_MODULE, +			   sizeof(struct snd_dbri), &card);  	if (err < 0)  		return err; @@ -2662,15 +2663,13 @@ _err:  	return err;  } -static int __devexit dbri_remove(struct platform_device *op) +static int dbri_remove(struct platform_device *op)  {  	struct snd_card *card = dev_get_drvdata(&op->dev);  	snd_dbri_free(card->private_data);  	snd_card_free(card); -	dev_set_drvdata(&op->dev, NULL); -  	return 0;  } @@ -2686,26 +2685,14 @@ static const struct of_device_id dbri_match[] = {  MODULE_DEVICE_TABLE(of, dbri_match); -static struct of_platform_driver dbri_sbus_driver = { +static struct platform_driver dbri_sbus_driver = {  	.driver = {  		.name = "dbri",  		.owner = THIS_MODULE,  		.of_match_table = dbri_match,  	},  	.probe		= dbri_probe, -	.remove		= __devexit_p(dbri_remove), +	.remove		= dbri_remove,  }; -/* Probe for the dbri chip and then attach the driver. */ -static int __init dbri_init(void) -{ -	return of_register_platform_driver(&dbri_sbus_driver); -} - -static void __exit dbri_exit(void) -{ -	of_unregister_platform_driver(&dbri_sbus_driver); -} - -module_init(dbri_init); -module_exit(dbri_exit); +module_platform_driver(dbri_sbus_driver);  | 
