aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2008-03-13 00:26:33 -0400
committerPaul Mackerras <paulus@samba.org>2008-03-13 00:26:33 -0400
commitbed04a4413376265746053be2a9cfbfc80c98ec9 (patch)
tree8f582294a655f70496cd08aedeb86de31dbad140 /lib
parente37c772e36a7943b2e0bd8f48312e78474c0df15 (diff)
parentc463be3520065ef8c05e3cbdf946c69604e91ceb (diff)
Merge branch 'linux-2.6'
Diffstat (limited to 'lib')
-rw-r--r--lib/iommu-helper.c10
-rw-r--r--lib/kobject.c11
2 files changed, 11 insertions, 10 deletions
diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c
index 495575a59ca6..a3b8d4c3f77a 100644
--- a/lib/iommu-helper.c
+++ b/lib/iommu-helper.c
@@ -40,10 +40,12 @@ static inline void set_bit_area(unsigned long *map, unsigned long i,
40 } 40 }
41} 41}
42 42
43static inline int is_span_boundary(unsigned int index, unsigned int nr, 43int iommu_is_span_boundary(unsigned int index, unsigned int nr,
44 unsigned long shift, 44 unsigned long shift,
45 unsigned long boundary_size) 45 unsigned long boundary_size)
46{ 46{
47 BUG_ON(!is_power_of_2(boundary_size));
48
47 shift = (shift + index) & (boundary_size - 1); 49 shift = (shift + index) & (boundary_size - 1);
48 return shift + nr > boundary_size; 50 return shift + nr > boundary_size;
49} 51}
@@ -57,7 +59,7 @@ unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
57again: 59again:
58 index = find_next_zero_area(map, size, start, nr, align_mask); 60 index = find_next_zero_area(map, size, start, nr, align_mask);
59 if (index != -1) { 61 if (index != -1) {
60 if (is_span_boundary(index, nr, shift, boundary_size)) { 62 if (iommu_is_span_boundary(index, nr, shift, boundary_size)) {
61 /* we could do more effectively */ 63 /* we could do more effectively */
62 start = index + 1; 64 start = index + 1;
63 goto again; 65 goto again;
diff --git a/lib/kobject.c b/lib/kobject.c
index d784daeb8571..0d03252f87a8 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -153,6 +153,10 @@ static void kobject_init_internal(struct kobject *kobj)
153 return; 153 return;
154 kref_init(&kobj->kref); 154 kref_init(&kobj->kref);
155 INIT_LIST_HEAD(&kobj->entry); 155 INIT_LIST_HEAD(&kobj->entry);
156 kobj->state_in_sysfs = 0;
157 kobj->state_add_uevent_sent = 0;
158 kobj->state_remove_uevent_sent = 0;
159 kobj->state_initialized = 1;
156} 160}
157 161
158 162
@@ -289,13 +293,8 @@ void kobject_init(struct kobject *kobj, struct kobj_type *ktype)
289 dump_stack(); 293 dump_stack();
290 } 294 }
291 295
292 kref_init(&kobj->kref); 296 kobject_init_internal(kobj);
293 INIT_LIST_HEAD(&kobj->entry);
294 kobj->ktype = ktype; 297 kobj->ktype = ktype;
295 kobj->state_in_sysfs = 0;
296 kobj->state_add_uevent_sent = 0;
297 kobj->state_remove_uevent_sent = 0;
298 kobj->state_initialized = 1;
299 return; 298 return;
300 299
301error: 300error: