Subject: Re: linux-next: firmware tree build failure

From: David Woodhouse <[email-masked]>
Date: Wed, 15 Apr 2009 02:56:41 +0100

On Tue, 2009-04-14 at 14:12 +1000, Stephen Rothwell wrote:
> Today's linux-next build (sparc64 defconfig) failed like this:
> 
> drivers/base/firmware_class.c: In function 'firmware_loading_store':
> drivers/base/firmware_class.c:173: error: 'PAGE_KERNEL_RO' undeclared
> (first use in this function)

I've updated the firmware tree with the following. Thanks.

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 90cb7c2..f19afa8 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -125,6 +125,10 @@ static ssize_t firmware_loading_show(struct device *dev,
 	return sprintf(buf, "%d\n", loading);
 }
 
+/* Some architectures don't have PAGE_KERNEL_RO */
+#ifndef PAGE_KERNEL_RO
+#define PAGE_KERNEL_RO PAGE_KERNEL
+#endif
 /**
  * firmware_loading_store - set value in the 'loading' control file
  * @dev: device pointer
@@ -224,7 +228,7 @@ firmware_data_read(struct kobject *kobj, struct bin_attribute *bin_attr,
 		void *page_data;
 		int page_nr = offset >> PAGE_SHIFT;
 		int page_ofs = offset & (PAGE_SIZE-1);
-		int page_cnt = min(PAGE_SIZE - page_ofs, count);
+		int page_cnt = min_t(size_t, PAGE_SIZE - page_ofs, count);
 
 		page_data = kmap(fw_priv->pages[page_nr]);
 
@@ -318,7 +322,7 @@ firmware_data_write(struct kobject *kobj, struct bin_attribute *bin_attr,
 		void *page_data;
 		int page_nr = offset >> PAGE_SHIFT;
 		int page_ofs = offset & (PAGE_SIZE - 1);
-		int page_cnt = min(PAGE_SIZE - page_ofs, count);
+		int page_cnt = min_t(size_t, PAGE_SIZE - page_ofs, count);
 
 		page_data = kmap(fw_priv->pages[page_nr]);

-- 
David Woodhouse                            Open Source Technology Centre
[email-masked]                              Intel Corporation