Re: 0 bit shift

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

 



On Wed, Mar 29, 2017 at 07:57:50PM -0400, valdis.kletnieks@xxxxxx wrote:
> On Thu, 30 Mar 2017 09:59:44 +1100, "Tobin C. Harding" said:
> > What is the reason for the zero bit shift in this code please?
> >
> > #define SDIO_STATE_PRESENT	(1<<0)		/* present in sysfs */
> >
> > file: include/linux/mmc/sdio_func.h
> 
> Most likely, to indicate that it's a bitmask in the 'unsigned int state'
> in the line above, rather than an integer.
> 
> See the other 2 uses of the flag in-tree:
> 
> [/usr/src/linux-next] git grep SDIO_STATE_PRESENT
> include/linux/mmc/sdio_func.h:#define SDIO_STATE_PRESENT        (1<<0)          /* present in sysfs */
> include/linux/mmc/sdio_func.h:#define sdio_func_present(f)      ((f)->state & SDIO_STATE_PRESENT)
> include/linux/mmc/sdio_func.h:#define sdio_func_set_present(f) ((f)->state |= SDIO_STATE_PRESENT)
> 

Awesome, thanks.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux