Re: [PATCH v2 3/4] mmc: renesas_sdhi: Fix sampling clock position selecting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > One idea I have is to let the loop iterate only over tap_num and then
> > use a mask 'BIT(i) | BIT(i+tap_num)' and work with binary operators
> > then. But maybe there are also macros to test and clear bit patterns?
> 
> I agree that the loop is clumsy. Unfortunately I can't find any bitmap 
> operations that work with bit patterns. If this where just integers the 
> following would have been a better solution:
> 
>     mask = (1 << host->tap_num) - 1;
>     taps = (host->taps & (host->taps >> host->tap_num)) & mask;
>     host->taps = (taps << host->tap_num) | taps;

My above sketch doesn't work?

	for (i = 0; i < host->tap_num; i++) {
		mask = BIT(i) | BIT(i + host->tap_num);
		if (host->taps & mask != mask)
			host->taps &= ~mask;
	}

Written from top of my head, maybe I overlooked something.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux