KVM is using test_and_set_bit_le() for this missing function; this patch
series corrects this usage.
As some drivers have their own definitions of set_bit_le(), which seem
to be incompatible with the generic one, renaming is also needed.
Note: the whole series is against linux-next.
Takuya Yoshikawa (4):
drivers/net/ethernet/sfc: Add efx_ prefix to set_bit_le()
drivers/net/ethernet/dec/tulip: Add tulip_ prefix to set_bit_le()
bitops: Introduce generic set_bit_le()
KVM: Replace test_and_set_bit_le() in mark_page_dirty_in_slot() with set_bit_le()
drivers/net/ethernet/dec/tulip/de2104x.c | 7 +++----
drivers/net/ethernet/dec/tulip/tulip_core.c | 7 +++----
drivers/net/ethernet/sfc/efx.c | 4 ++--
drivers/net/ethernet/sfc/net_driver.h | 4 ++--
drivers/net/ethernet/sfc/nic.c | 4 ++--
include/asm-generic/bitops/le.h | 5 +++++
virt/kvm/kvm_main.c | 3 +--
7 files changed, 18 insertions(+), 16 deletions(-)
--
1.7.5.4
From: Takuya Yoshikawa <redacted>
Now that we have defined generic set_bit_le() we do not need to use
test_and_set_bit_le() for atomically setting a bit.
Signed-off-by: Takuya Yoshikawa <redacted>
---
virt/kvm/kvm_main.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
From: Takuya Yoshikawa <redacted>
Needed to replace test_and_set_bit_le() in virt/kvm/kvm_main.c which is
being used for this missing function.
Signed-off-by: Takuya Yoshikawa <redacted>
Cc: Arnd Bergmann <arnd@arndb.de>
---
include/asm-generic/bitops/le.h | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
@@ -1081,13 +1081,13 @@ static inline struct efx_rx_buffer *efx_rx_buffer(struct efx_rx_queue *rx_queue,}/* Set bit in a little-endian bitfield */-staticinlinevoidset_bit_le(unsignednr,unsignedchar*addr)+staticinlinevoidefx_set_bit_le(unsignednr,unsignedchar*addr){addr[nr/8]|=(1<<(nr%8));}/* Clear bit in a little-endian bitfield */-staticinlinevoidclear_bit_le(unsignednr,unsignedchar*addr)+staticinlinevoidefx_clear_bit_le(unsignednr,unsignedchar*addr){addr[nr/8]&=~(1<<(nr%8));}
/* Set bit in a little-endian bitfield */
-static inline void set_bit_le(unsigned nr, unsigned char *addr)
+static inline void efx_set_bit_le(unsigned nr, unsigned char *addr)
{
addr[nr / 8] |= (1 << (nr % 8));
}
/* Clear bit in a little-endian bitfield */
-static inline void clear_bit_le(unsigned nr, unsigned char *addr)
+static inline void efx_clear_bit_le(unsigned nr, unsigned char *addr)
{
addr[nr / 8] &= ~(1 << (nr % 8));
}
Hmm, any reason why we're not just using the existing non-atomic
__set_bit_le() here? I think the helpers in sfc and tulip can
just get removed if you use those.
Arnd
From: Takuya Yoshikawa <redacted>
Needed to replace test_and_set_bit_le() in virt/kvm/kvm_main.c which is
being used for this missing function.
Signed-off-by: Takuya Yoshikawa <redacted>
Cc: Arnd Bergmann <arnd@arndb.de>
I would recommend adding the corresponding clear_bit_le() along with
set_bit_le, so the next person who needs that doesn't have to make
yet another patch.
Arnd
new frame, not around filling de->setup_frame. This is non-deterministic
when re-entered but still correct. */
-#undef set_bit_le
-#define set_bit_le(i,p) do { ((char *)(p))[(i)/8] |= (1<<((i)%8)); } while(0)
+#define tulip_set_bit_le(i,p) do { ((char *)(p))[(i)/8] |= (1<<((i)%8)); } while(0)
I am ok with this patch going in. This code predates the clear
understanding of bit_ops that we have now and will continue to work
with this patch.
If you have time to follow Arnd's suggestion to use __set_bit_le()
(and removing both local definitions), that would be better. Either
way:
Acked-by: Grant Grundler <redacted>
thanks!
grant
@@ -1010,8 +1010,7 @@ static int private_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
new frame, not around filling tp->setup_frame. This is non-deterministic
when re-entered but still correct. */
-#undef set_bit_le
-#define set_bit_le(i,p) do { ((char *)(p))[(i)/8] |= (1<<((i)%8)); } while(0)
+#define tulip_set_bit_le(i,p) do { ((char *)(p))[(i)/8] |= (1<<((i)%8)); } while(0)
static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
{
On Mon, 11 Jun 2012 14:09:15 +0000
Arnd Bergmann [off-list ref] wrote:
On Monday 11 June 2012, Takuya Yoshikawa wrote:
quoted
/* Set bit in a little-endian bitfield */
-static inline void set_bit_le(unsigned nr, unsigned char *addr)
+static inline void efx_set_bit_le(unsigned nr, unsigned char *addr)
{
addr[nr / 8] |= (1 << (nr % 8));
}
/* Clear bit in a little-endian bitfield */
-static inline void clear_bit_le(unsigned nr, unsigned char *addr)
+static inline void efx_clear_bit_le(unsigned nr, unsigned char *addr)
{
addr[nr / 8] &= ~(1 << (nr % 8));
}
Hmm, any reason why we're not just using the existing non-atomic
__set_bit_le() here? I think the helpers in sfc and tulip can
just get removed if you use those.
__set_bit_le() assumes long word alignment and does endian conversion
when needed.
To be honest, I am a bit scared of changing drivers which I cannot test
on real hardware.
Takuya
On Mon, 11 Jun 2012 14:10:26 +0000
Arnd Bergmann [off-list ref] wrote:
On Monday 11 June 2012, Takuya Yoshikawa wrote:
quoted
From: Takuya Yoshikawa <redacted>
Needed to replace test_and_set_bit_le() in virt/kvm/kvm_main.c which is
being used for this missing function.
Signed-off-by: Takuya Yoshikawa <redacted>
Cc: Arnd Bergmann <arnd@arndb.de>
I would recommend adding the corresponding clear_bit_le() along with
set_bit_le, so the next person who needs that doesn't have to make
yet another patch.
I will do in the next version.
Now I have also noticed that I need to add the same code to powerpc's
bitops file.
Takuya
Hmm, any reason why we're not just using the existing non-atomic
__set_bit_le() here? I think the helpers in sfc and tulip can
just get removed if you use those.
__set_bit_le() assumes long word alignment and does endian conversion
when needed.
Ah, I see.
To be honest, I am a bit scared of changing drivers which I cannot test
on real hardware.
Ok, let's take your patches as they are then.
With the change to add clear_bit_le:
Acked-by: Arnd Bergmann <arnd@arndb.de>
From: Ben Hutchings <hidden> Date: 2012-06-12 19:23:40
There are now standard functions for dealing with little-endian bit
arrays, so use them instead of our own implementations.
Signed-off-by: Ben Hutchings <redacted>
---
Please use this version instead.
Ben.
drivers/net/ethernet/sfc/efx.c | 4 ++--
drivers/net/ethernet/sfc/net_driver.h | 12 ------------
drivers/net/ethernet/sfc/nic.c | 4 ++--
3 files changed, 4 insertions(+), 16 deletions(-)
@@ -1080,18 +1080,6 @@ static inline struct efx_rx_buffer *efx_rx_buffer(struct efx_rx_queue *rx_queue,return&rx_queue->buffer[index];}-/* Set bit in a little-endian bitfield */-staticinlinevoidset_bit_le(unsignednr,unsignedchar*addr)-{-addr[nr/8]|=(1<<(nr%8));-}--/* Clear bit in a little-endian bitfield */-staticinlinevoidclear_bit_le(unsignednr,unsignedchar*addr)-{-addr[nr/8]&=~(1<<(nr%8));-}-/***EFX_MAX_FRAME_LEN-calculatemaximumframelength
--
1.7.7.6
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.