Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325857
b: refs/heads/master
c: b53d657
h: refs/heads/master
i:
  325855: 602bfb8
v: v3
  • Loading branch information
Sebastian Andrzej Siewior authored and Greg Kroah-Hartman committed Sep 10, 2012
1 parent 7d4e6f4 commit 279fc64
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8a424bf40d772fedacc91862ecc86f10541fabb3
refs/heads/master: b53d657d84f530e5d83f34ff1b81ceedad3faa31
6 changes: 3 additions & 3 deletions trunk/drivers/usb/core/hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include <linux/bcd.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h>
Expand Down Expand Up @@ -123,9 +124,8 @@ static inline int is_root_hub(struct usb_device *udev)
*/

/*-------------------------------------------------------------------------*/

#define KERNEL_REL ((LINUX_VERSION_CODE >> 16) & 0x0ff)
#define KERNEL_VER ((LINUX_VERSION_CODE >> 8) & 0x0ff)
#define KERNEL_REL bin2bcd(((LINUX_VERSION_CODE >> 16) & 0x0ff))
#define KERNEL_VER bin2bcd(((LINUX_VERSION_CODE >> 8) & 0x0ff))

/* usb 3.0 root hub device descriptor */
static const u8 usb3_rh_dev_descriptor[18] = {
Expand Down
17 changes: 15 additions & 2 deletions trunk/include/linux/bcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,20 @@

#include <linux/compiler.h>

unsigned bcd2bin(unsigned char val) __attribute_const__;
unsigned char bin2bcd(unsigned val) __attribute_const__;
#define bcd2bin(x) \
(__builtin_constant_p((u8 )(x)) ? \
const_bcd2bin(x) : \
_bcd2bin(x))

#define bin2bcd(x) \
(__builtin_constant_p((u8 )(x)) ? \
const_bin2bcd(x) : \
_bin2bcd(x))

#define const_bcd2bin(x) (((x) & 0x0f) + ((x) >> 4) * 10)
#define const_bin2bcd(x) ((((x) / 10) << 4) + (x) % 10)

unsigned _bcd2bin(unsigned char val) __attribute_const__;
unsigned char _bin2bcd(unsigned val) __attribute_const__;

#endif /* _BCD_H */
8 changes: 4 additions & 4 deletions trunk/lib/bcd.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include <linux/bcd.h>
#include <linux/export.h>

unsigned bcd2bin(unsigned char val)
unsigned _bcd2bin(unsigned char val)
{
return (val & 0x0f) + (val >> 4) * 10;
}
EXPORT_SYMBOL(bcd2bin);
EXPORT_SYMBOL(_bcd2bin);

unsigned char bin2bcd(unsigned val)
unsigned char _bin2bcd(unsigned val)
{
return ((val / 10) << 4) + val % 10;
}
EXPORT_SYMBOL(bin2bcd);
EXPORT_SYMBOL(_bin2bcd);

0 comments on commit 279fc64

Please sign in to comment.