Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
089f0b0e
Commit
089f0b0e
authored
Jan 16, 2005
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Plain Diff
Merge kroah.com:/home/greg/linux/BK/bleed-2.6
into kroah.com:/home/greg/linux/BK/w1-2.6
parents
bd24a6bd
6cbce905
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
36 deletions
+85
-36
drivers/w1/w1.c
drivers/w1/w1.c
+69
-36
drivers/w1/w1.h
drivers/w1/w1.h
+5
-0
drivers/w1/w1_io.c
drivers/w1/w1_io.c
+10
-0
drivers/w1/w1_io.h
drivers/w1/w1_io.h
+1
-0
No files found.
drivers/w1/w1.c
View file @
089f0b0e
...
@@ -467,17 +467,75 @@ static void w1_slave_detach(struct w1_slave *sl)
...
@@ -467,17 +467,75 @@ static void w1_slave_detach(struct w1_slave *sl)
w1_netlink_send
(
sl
->
master
,
&
msg
);
w1_netlink_send
(
sl
->
master
,
&
msg
);
}
}
static
void
w1_search
(
struct
w1_master
*
dev
)
static
struct
w1_master
*
w1_search_master
(
unsigned
long
data
)
{
{
u64
last
,
rn
,
tmp
;
struct
w1_master
*
dev
;
int
i
,
count
=
0
,
slave_count
;
int
found
=
0
;
int
last_family_desc
,
last_zero
,
last_device
;
int
search_bit
,
id_bit
,
comp_bit
,
desc_bit
;
spin_lock_irq
(
&
w1_mlock
);
struct
list_head
*
ent
;
list_for_each_entry
(
dev
,
&
w1_masters
,
w1_master_entry
)
{
if
(
dev
->
bus_master
->
data
==
data
)
{
found
=
1
;
atomic_inc
(
&
dev
->
refcnt
);
break
;
}
}
spin_unlock_irq
(
&
w1_mlock
);
return
(
found
)
?
dev
:
NULL
;
}
void
w1_slave_found
(
unsigned
long
data
,
u64
rn
)
{
int
slave_count
;
struct
w1_slave
*
sl
;
struct
w1_slave
*
sl
;
struct
list_head
*
ent
;
struct
w1_reg_num
*
tmp
;
int
family_found
=
0
;
int
family_found
=
0
;
struct
w1_master
*
dev
;
dev
->
attempts
++
;
dev
=
w1_search_master
(
data
);
if
(
!
dev
)
{
printk
(
KERN_ERR
"Failed to find w1 master device for data %08lx, it is impossible.
\n
"
,
data
);
return
;
}
tmp
=
(
struct
w1_reg_num
*
)
&
rn
;
slave_count
=
0
;
list_for_each
(
ent
,
&
dev
->
slist
)
{
sl
=
list_entry
(
ent
,
struct
w1_slave
,
w1_slave_entry
);
if
(
sl
->
reg_num
.
family
==
tmp
->
family
&&
sl
->
reg_num
.
id
==
tmp
->
id
&&
sl
->
reg_num
.
crc
==
tmp
->
crc
)
{
set_bit
(
W1_SLAVE_ACTIVE
,
(
long
*
)
&
sl
->
flags
);
break
;
}
else
if
(
sl
->
reg_num
.
family
==
tmp
->
family
)
{
family_found
=
1
;
break
;
}
slave_count
++
;
}
if
(
slave_count
==
dev
->
slave_count
&&
rn
&&
((
rn
>>
56
)
&
0xff
)
==
w1_calc_crc8
((
u8
*
)
&
rn
,
7
))
{
w1_attach_slave_device
(
dev
,
(
struct
w1_reg_num
*
)
&
rn
);
}
atomic_dec
(
&
dev
->
refcnt
);
}
void
w1_search
(
struct
w1_master
*
dev
)
{
u64
last
,
rn
,
tmp
;
int
i
,
count
=
0
;
int
last_family_desc
,
last_zero
,
last_device
;
int
search_bit
,
id_bit
,
comp_bit
,
desc_bit
;
search_bit
=
id_bit
=
comp_bit
=
0
;
search_bit
=
id_bit
=
comp_bit
=
0
;
rn
=
tmp
=
last
=
0
;
rn
=
tmp
=
last
=
0
;
...
@@ -556,32 +614,7 @@ static void w1_search(struct w1_master *dev)
...
@@ -556,32 +614,7 @@ static void w1_search(struct w1_master *dev)
desc_bit
=
last_zero
;
desc_bit
=
last_zero
;
slave_count
=
0
;
w1_slave_found
(
dev
->
bus_master
->
data
,
rn
);
list_for_each
(
ent
,
&
dev
->
slist
)
{
struct
w1_reg_num
*
tmp
;
tmp
=
(
struct
w1_reg_num
*
)
&
rn
;
sl
=
list_entry
(
ent
,
struct
w1_slave
,
w1_slave_entry
);
if
(
sl
->
reg_num
.
family
==
tmp
->
family
&&
sl
->
reg_num
.
id
==
tmp
->
id
&&
sl
->
reg_num
.
crc
==
tmp
->
crc
)
{
set_bit
(
W1_SLAVE_ACTIVE
,
(
long
*
)
&
sl
->
flags
);
break
;
}
else
if
(
sl
->
reg_num
.
family
==
tmp
->
family
)
{
family_found
=
1
;
break
;
}
slave_count
++
;
}
if
(
slave_count
==
dev
->
slave_count
&&
rn
&&
((
rn
>>
56
)
&
0xff
)
==
w1_calc_crc8
((
u8
*
)
&
rn
,
7
))
{
w1_attach_slave_device
(
dev
,
(
struct
w1_reg_num
*
)
&
rn
);
}
}
}
}
}
...
@@ -721,7 +754,7 @@ int w1_process(void *data)
...
@@ -721,7 +754,7 @@ int w1_process(void *data)
clear_bit
(
W1_SLAVE_ACTIVE
,
(
long
*
)
&
sl
->
flags
);
clear_bit
(
W1_SLAVE_ACTIVE
,
(
long
*
)
&
sl
->
flags
);
}
}
w1_search
(
dev
);
w1_search_devices
(
dev
,
w1_slave_found
);
list_for_each_safe
(
ent
,
n
,
&
dev
->
slist
)
{
list_for_each_safe
(
ent
,
n
,
&
dev
->
slist
)
{
sl
=
list_entry
(
ent
,
struct
w1_slave
,
w1_slave_entry
);
sl
=
list_entry
(
ent
,
struct
w1_slave
,
w1_slave_entry
);
...
...
drivers/w1/w1.h
View file @
089f0b0e
...
@@ -74,6 +74,8 @@ struct w1_slave
...
@@ -74,6 +74,8 @@ struct w1_slave
struct
device_attribute
attr_name
,
attr_val
;
struct
device_attribute
attr_name
,
attr_val
;
};
};
typedef
void
(
*
w1_slave_found_callback
)(
unsigned
long
,
u64
);
struct
w1_bus_master
struct
w1_bus_master
{
{
unsigned
long
data
;
unsigned
long
data
;
...
@@ -90,6 +92,8 @@ struct w1_bus_master
...
@@ -90,6 +92,8 @@ struct w1_bus_master
u8
(
*
touch_bit
)(
unsigned
long
,
u8
);
u8
(
*
touch_bit
)(
unsigned
long
,
u8
);
u8
(
*
reset_bus
)(
unsigned
long
);
u8
(
*
reset_bus
)(
unsigned
long
);
void
(
*
search
)(
unsigned
long
,
w1_slave_found_callback
);
};
};
struct
w1_master
struct
w1_master
...
@@ -127,6 +131,7 @@ struct w1_master
...
@@ -127,6 +131,7 @@ struct w1_master
int
w1_create_master_attributes
(
struct
w1_master
*
);
int
w1_create_master_attributes
(
struct
w1_master
*
);
void
w1_destroy_master_attributes
(
struct
w1_master
*
);
void
w1_destroy_master_attributes
(
struct
w1_master
*
);
void
w1_search
(
struct
w1_master
*
dev
);
#endif
/* __KERNEL__ */
#endif
/* __KERNEL__ */
...
...
drivers/w1/w1_io.c
View file @
089f0b0e
...
@@ -174,6 +174,15 @@ u8 w1_calc_crc8(u8 * data, int len)
...
@@ -174,6 +174,15 @@ u8 w1_calc_crc8(u8 * data, int len)
return
crc
;
return
crc
;
}
}
void
w1_search_devices
(
struct
w1_master
*
dev
,
w1_slave_found_callback
cb
)
{
dev
->
attempts
++
;
if
(
dev
->
bus_master
->
search
)
dev
->
bus_master
->
search
(
dev
->
bus_master
->
data
,
cb
);
else
w1_search
(
dev
);
}
EXPORT_SYMBOL
(
w1_write_bit
);
EXPORT_SYMBOL
(
w1_write_bit
);
EXPORT_SYMBOL
(
w1_write_8
);
EXPORT_SYMBOL
(
w1_write_8
);
EXPORT_SYMBOL
(
w1_read_bit
);
EXPORT_SYMBOL
(
w1_read_bit
);
...
@@ -183,3 +192,4 @@ EXPORT_SYMBOL(w1_calc_crc8);
...
@@ -183,3 +192,4 @@ EXPORT_SYMBOL(w1_calc_crc8);
EXPORT_SYMBOL
(
w1_delay
);
EXPORT_SYMBOL
(
w1_delay
);
EXPORT_SYMBOL
(
w1_read_block
);
EXPORT_SYMBOL
(
w1_read_block
);
EXPORT_SYMBOL
(
w1_write_block
);
EXPORT_SYMBOL
(
w1_write_block
);
EXPORT_SYMBOL
(
w1_search_devices
);
drivers/w1/w1_io.h
View file @
089f0b0e
...
@@ -34,5 +34,6 @@ int w1_reset_bus(struct w1_master *);
...
@@ -34,5 +34,6 @@ int w1_reset_bus(struct w1_master *);
u8
w1_calc_crc8
(
u8
*
,
int
);
u8
w1_calc_crc8
(
u8
*
,
int
);
void
w1_write_block
(
struct
w1_master
*
,
u8
*
,
int
);
void
w1_write_block
(
struct
w1_master
*
,
u8
*
,
int
);
u8
w1_read_block
(
struct
w1_master
*
,
u8
*
,
int
);
u8
w1_read_block
(
struct
w1_master
*
,
u8
*
,
int
);
void
w1_search_devices
(
struct
w1_master
*
dev
,
w1_slave_found_callback
cb
);
#endif
/* __W1_IO_H */
#endif
/* __W1_IO_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment