Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ab39926 authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Jaroslav Kysela
Browse files

[ALSA] use the ALIGN macro



Use the ALIGN macro instead of manual calculations.

Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent e7d24f0b
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -27,7 +27,7 @@


/* table entries are align to 32 */
/* table entries are align to 32 */
#define SGBUF_TBL_ALIGN		32
#define SGBUF_TBL_ALIGN		32
#define sgbuf_align_table(tbl)	((((tbl) + SGBUF_TBL_ALIGN - 1) / SGBUF_TBL_ALIGN) * SGBUF_TBL_ALIGN)
#define sgbuf_align_table(tbl)	ALIGN((tbl), SGBUF_TBL_ALIGN)


int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab)
int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab)
{
{
+3 −4
Original line number Original line Diff line number Diff line
@@ -143,9 +143,8 @@ static int snd_gf1_mem_find(struct snd_gf1_mem * alloc,
	struct snd_gf1_mem_block *pblock;
	struct snd_gf1_mem_block *pblock;
	unsigned int ptr1, ptr2;
	unsigned int ptr1, ptr2;


	align--;
	if (w_16 && align < 2)
	if (w_16 && align < 1)
		align = 2;
		align = 1;
	block->flags = w_16 ? SNDRV_GF1_MEM_BLOCK_16BIT : 0;
	block->flags = w_16 ? SNDRV_GF1_MEM_BLOCK_16BIT : 0;
	block->owner = SNDRV_GF1_MEM_OWNER_DRIVER;
	block->owner = SNDRV_GF1_MEM_OWNER_DRIVER;
	block->share = 0;
	block->share = 0;
@@ -165,7 +164,7 @@ static int snd_gf1_mem_find(struct snd_gf1_mem * alloc,
			if (pblock->next->ptr < boundary)
			if (pblock->next->ptr < boundary)
				ptr2 = pblock->next->ptr;
				ptr2 = pblock->next->ptr;
		}
		}
		ptr1 = (pblock->ptr + pblock->size + align) & ~align;
		ptr1 = ALIGN(pblock->ptr + pblock->size, align);
		if (ptr1 >= ptr2)
		if (ptr1 >= ptr2)
			continue;
			continue;
		size1 = ptr2 - ptr1;
		size1 = ptr2 - ptr1;
+1 −1
Original line number Original line Diff line number Diff line
@@ -1068,7 +1068,7 @@ wavefront_send_sample (snd_wavefront_t *dev,
			blocksize = max_blksize;
			blocksize = max_blksize;
		} else {
		} else {
			/* round to nearest 16-byte value */
			/* round to nearest 16-byte value */
			blocksize = ((length-written+7)&~0x7);
			blocksize = ALIGN(length - written, 8);
		}
		}


		if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_BLOCK, NULL, NULL)) {
		if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_BLOCK, NULL, NULL)) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -699,7 +699,7 @@ static int __devinit snd_bt87x_pcm(struct snd_bt87x *chip, int device, char *nam
						     SNDRV_DMA_TYPE_DEV_SG,
						     SNDRV_DMA_TYPE_DEV_SG,
						     snd_dma_pci_data(chip->pci),
						     snd_dma_pci_data(chip->pci),
							128 * 1024,
							128 * 1024,
							(255 * 4092 + 1023) & ~1023);
							ALIGN(255 * 4092, 1024));
}
}


static int __devinit snd_bt87x_create(struct snd_card *card,
static int __devinit snd_bt87x_create(struct snd_card *card,
+1 −1
Original line number Original line Diff line number Diff line
@@ -1337,7 +1337,7 @@ static struct esm_memory *snd_es1968_new_memory(struct es1968 *chip, int size)
	struct esm_memory *buf;
	struct esm_memory *buf;
	struct list_head *p;
	struct list_head *p;
	
	
	size = ((size + ESM_MEM_ALIGN - 1) / ESM_MEM_ALIGN) * ESM_MEM_ALIGN;
	size = ALIGN(size, ESM_MEM_ALIGN);
	mutex_lock(&chip->memory_mutex);
	mutex_lock(&chip->memory_mutex);
	list_for_each(p, &chip->buf_list) {
	list_for_each(p, &chip->buf_list) {
		buf = list_entry(p, struct esm_memory, list);
		buf = list_entry(p, struct esm_memory, list);
Loading