moving to is_power_of_2
Subsystems (17)
PATCH 2/5 moving to is_power_of_2
Removing instances of (n&(n-1)) for power of 2
check with is_power_of_2 from linux/log.h.
Signed-off-by vignesh babu <[email protected]>
--- arch/ia64/mm/hugetlbpage.c | 1 - drivers/block/rd.c | 1 - drivers/md/dm-snap.c | 1 - drivers/net/cxgb3/cxgb3_main.c | 2 -- drivers/net/pcmcia/pcnet_cs.c | 1 - drivers/rtc/rtc-s3c.c | 2 -- drivers/s390/block/dasd_int.h | 1 - drivers/video/vesafb.c | 1 - fs/block_dev.c | 1 - fs/ext2/super.c | 1 - fs/ext3/super.c | 1 - fs/ext4/super.c | 2 -- fs/fat/inode.c | 4 ---- fs/hfsplus/btree.c | 1 - fs/nfs/internal.h | 1 - fs/ntfs/inode.c | 1 - fs/ntfs/logfile.c | 1 - fs/ufs/super.c | 1 - kernel/kfifo.c | 1 - net/core/neighbour.c | 1 - sound/core/rtctimer.c | 1 - 21 files changed, 0 insertions(+), 27 deletions(-)
arch/ia64/mm/hugetlbpage.c +0 -1
@@ -176,7 +176,6 @@ static int __init hugetlb_setup_sz(char *str) tr_pages =0x15557000UL ; size =memparse (str, &str); -//if (*str || (size & (size-1)) || !(tr_pages & size) || if (*str || !is_power_of_2 (size) || !(tr_pages & size) || size <=PAGE_SIZE || size >= (1UL <<PAGE_SHIFT <<MAX_ORDER )) {
drivers/block/rd.c +0 -1
@@ -422,7 +422,6 @@ static int __init rd_init(void)int err = -ENOMEM ;if (rd_blocksize >PAGE_SIZE || rd_blocksize <512 || -//(rd_blocksize & (rd_blocksize-1))) { (!is_power_of_2 (rd_blocksize))) {printk ("RAMDISK: wrong blocksize %d, reverting to defaults\n" , rd_blocksize);
drivers/md/dm-snap.c +0 -1
@@ -415,7 +415,6 @@ static int set_chunk_size(struct dm_snapshot *s, const char *chunk_size_arg, chunk_size =round_up (chunk_size,PAGE_SIZE >>9 );/* Check chunk_size is a power of 2 */ -//if (chunk_size & (chunk_size - 1)) { if (!is_power_of_2 (chunk_size)) { *error ="Chunk size is not a power of 2" ;return -EINVAL ;
drivers/net/cxgb3/cxgb3_main.c +0 -2
@@ -1793,8 +1793,6 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)return -EBUSY ;if (copy_from_user (&m, useraddr,sizeof (m)))return -EFAULT ; -//if (!m.rx_pg_sz || (m.rx_pg_sz & (m.rx_pg_sz - 1)) || -//!m.tx_pg_sz || (m.tx_pg_sz & (m.tx_pg_sz - 1))) if (!is_power_of_2 (m.rx_pg_sz) || !is_power_of_2 (m.tx_pg_sz))return -EINVAL ;/* not power of 2 */
drivers/net/pcmcia/pcnet_cs.c +0 -1
@@ -1484,7 +1484,6 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, window_size =32 *1024 ;/* Make sure it's a power of two. */ -//while ((window_size & (window_size - 1)) != 0) while (!is_power_of_2 (window_size)) window_size += window_size & ~(window_size -1 );
drivers/rtc/rtc-s3c.c +0 -2
@@ -311,8 +311,6 @@ static int s3c_rtc_ioctl(struct device *dev,case RTC_IRQP_SET :/* check for power of 2 */ - -//if ((arg & (arg-1)) != 0 || arg < 1) { if (!arg || !is_power_of_2 (arg)) { ret = -EINVAL ; goto exit;
drivers/s390/block/dasd_int.h +0 -1
@@ -457,7 +457,6 @@ dasd_free_chunk(struct list_head *chunk_list, void *mem)static inline int dasd_check_blocksize (int bsize) { -//if (bsize < 512 || bsize > 4096 || (bsize & (bsize - 1)) != 0) if (bsize <512 || bsize >4096 || !is_power_of_2 (bsize))return -EMEDIUMTYPE ;return 0 ;
drivers/video/vesafb.c +0 -1
@@ -422,7 +422,6 @@ static int __init vesafb_probe(struct platform_device *dev)int rc;/* Find the largest power-of-two */ -//while (temp_size & (temp_size - 1)) while (!is_power_of_2 (temp_size)) temp_size &= (temp_size -1 );
fs/block_dev.c +0 -1
@@ -66,7 +66,6 @@ static void kill_bdev(struct block_device *bdev)int set_blocksize (struct block_device *bdev,int size) {/* Size must be a power of two, and between 512 and PAGE_SIZE */ -//if (size > PAGE_SIZE || size < 512 || (size & (size-1))) if (size >PAGE_SIZE || size <512 || !is_power_of_2 (size))return -EINVAL ;
fs/ext2/super.c +0 -1
@@ -803,7 +803,6 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) sbi->s_inode_size =le16_to_cpu (es->s_inode_size); sbi->s_first_ino =le32_to_cpu (es->s_first_ino);if ((sbi->s_inode_size <EXT2_GOOD_OLD_INODE_SIZE ) || -//(sbi->s_inode_size & (sbi->s_inode_size - 1)) || !is_power_of_2 (sbi->s_inode_size) || (sbi->s_inode_size > blocksize)) { printk ("EXT2-fs: unsupported inode size: %d\n",
fs/ext3/super.c +0 -1
@@ -1566,7 +1566,6 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) sbi->s_inode_size =le16_to_cpu (es->s_inode_size); sbi->s_first_ino =le32_to_cpu (es->s_first_ino);if ((sbi->s_inode_size <EXT3_GOOD_OLD_INODE_SIZE ) || -//(sbi->s_inode_size & (sbi->s_inode_size - 1)) || !is_power_of_2 (sbi->s_inode_size) || (sbi->s_inode_size > blocksize)) { printk (KERN_ERR
fs/ext4/super.c +0 -2
@@ -1625,7 +1625,6 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) sbi->s_inode_size =le16_to_cpu (es->s_inode_size); sbi->s_first_ino =le32_to_cpu (es->s_first_ino);if ((sbi->s_inode_size <EXT4_GOOD_OLD_INODE_SIZE ) || -//(sbi->s_inode_size & (sbi->s_inode_size - 1)) || !is_power_of_2 (sbi->s_inode_size) || (sbi->s_inode_size > blocksize)) { printk (KERN_ERR
@@ -1646,7 +1645,6 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)if (EXT4_HAS_INCOMPAT_FEATURE (sb,EXT4_FEATURE_INCOMPAT_64BIT )) {if (sbi->s_desc_size <EXT4_MIN_DESC_SIZE_64BIT || sbi->s_desc_size >EXT4_MAX_DESC_SIZE || -//sbi->s_desc_size & (sbi->s_desc_size - 1)) { !is_power_of_2 (sbi->s_desc_size)) { printk(KERN_ERR "EXT4-fs: unsupported descriptor size %lu\n",
fs/fat/inode.c +0 -4
@@ -1217,8 +1217,6 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, } logical_sector_size le16_to_cpu(get_unaligned((__le16 *)&b->sector_size)); -//if (!logical_sector_size -// || (logical_sector_size & (logical_sector_size - 1)) if (!is_power_of_2 (logical_sector_size) || (logical_sector_size <512 ) || (PAGE_CACHE_SIZE < logical_sector_size)) {
@@ -1229,8 +1227,6 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, goto out_invalid; } sbi->sec_per_clus = b->sec_per_clus; -//if (!sbi->sec_per_clus -// || (sbi->sec_per_clus & (sbi->sec_per_clus - 1))) { if (!is_power_of_2 (sbi->sec_per_clus)) {if (!silent) printk(KERN_ERR "FAT: bogus sectors per cluster %u\n",
fs/hfsplus/btree.c +0 -1
@@ -70,7 +70,6 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id) } size = tree->node_size; -//if (!size || size & (size - 1)) if (!is_power_of_2 (size)) goto fail_page;if (!tree->node_count)
fs/nfs/internal.h +0 -1
@@ -171,7 +171,6 @@ static inlineunsigned long nfs_block_bits (unsigned long bsize,unsigned char *nrbitsp) {/* make sure blocksize is a power of two */ -//if ((bsize & (bsize - 1)) || nrbitsp) { if (!is_power_of_2 (bsize) || nrbitsp) {unsigned char nrbits;
fs/ntfs/inode.c +0 -1
@@ -1576,7 +1576,6 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)ntfs_debug ("Index collation rule is 0x%x." ,le32_to_cpu (ir->collation_rule)); ni->itype.index.block_size =le32_to_cpu (ir->index_block_size); -//if (ni->itype.index.block_size & (ni->itype.index.block_size - 1)) { if (!is_power_of_2 (ni->itype.index.block_size)) {ntfs_error (vi->i_sb,"Index block size (%u) is not a power of " "two." , ni->itype.index.block_size);
fs/ntfs/logfile.c +0 -1
@@ -66,7 +66,6 @@ static bool ntfs_check_restart_page_header(struct inode *vi, logfile_log_page_size < NTFS_BLOCK_SIZE || logfile_system_page_size & (logfile_system_page_size - 1) || - //logfile_log_page_size & (logfile_log_page_size - 1)) { !is_power_of_2(logfile_log_page_size)) {ntfs_error (vi->i_sb,"$LogFile uses unsupported page size." );return false;
fs/ufs/super.c +0 -1
@@ -851,7 +851,6 @@ magic_found: uspi->s_fmask =fs32_to_cpu (sb, usb1->fs_fmask); uspi->s_fshift =fs32_to_cpu (sb, usb1->fs_fshift); -//if (uspi->s_fsize & (uspi->s_fsize - 1)) { if (!is_power_of_2 (uspi->s_fsize)) {printk (KERN_ERR "ufs_read_super: fragment size %u is not a power of 2\n" , uspi->s_fsize);
kernel/kfifo.c +0 -1
@@ -42,7 +42,6 @@ struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size,struct kfifo *fifo;/* size must be a power of 2 */ -//BUG_ON(size & (size - 1)); BUG_ON (!is_power_of_2 (size)); fifo =kmalloc (sizeof (struct kfifo ), gfp_mask);
net/core/neighbour.c +0 -1
@@ -311,7 +311,6 @@ static void neigh_hash_grow(struct neigh_table *tbl, unsigned long new_entries)NEIGH_CACHE_STAT_INC (tbl, hash_grows); -//BUG_ON(new_entries & (new_entries - 1)); BUG_ON (!is_power_of_2 (new_entries)); new_hash =neigh_hash_alloc (new_entries);if (!new_hash)
sound/core/rtctimer.c +0 -1
@@ -130,7 +130,6 @@ static int __init rtctimer_init(void)struct snd_timer *timer;if (rtctimer_freq <2 || rtctimer_freq >8192 || -// (rtctimer_freq & (rtctimer_freq - 1)) != 0) { !is_power_of_2 (rtctimer_freq)) {snd_printk (KERN_ERR "rtctimer: invalid frequency %d\n" , rtctimer_freq);
Signature · 12 lines
1.4.4.2 -- Regards, Vignesh Babu BM _____________________________________________________________ "Why is it that every time I'm with you, makes me believe in magic?" _______________________________________________ Kernel-janitors mailing list [email protected] https://lists.osdl.org/mailman/listinfo/kernel-janitors