aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpacpi/rsparser.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/pnpacpi/rsparser.c')
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index d3ca8e035c19..a512908bf4e3 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -173,34 +173,18 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev, u64 start,
173} 173}
174 174
175static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev, 175static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev,
176 u64 mem, u64 len, 176 u64 start, u64 len,
177 int write_protect) 177 int write_protect)
178{ 178{
179 struct resource *res; 179 int flags = 0;
180 int i; 180 u64 end = start + len - 1;
181 static unsigned char warned;
182 181
183 for (i = 0; i < PNP_MAX_MEM; i++) { 182 if (len == 0)
184 res = pnp_get_resource(dev, IORESOURCE_MEM, i); 183 flags |= IORESOURCE_DISABLED;
185 if (!pnp_resource_valid(res)) 184 if (write_protect == ACPI_READ_WRITE_MEMORY)
186 break; 185 flags |= IORESOURCE_MEM_WRITEABLE;
187 } 186
188 if (i < PNP_MAX_MEM) { 187 pnp_add_mem_resource(dev, start, end, flags);
189 res->flags = IORESOURCE_MEM; // Also clears _UNSET flag
190 if (len <= 0) {
191 res->flags |= IORESOURCE_DISABLED;
192 return;
193 }
194 if (write_protect == ACPI_READ_WRITE_MEMORY)
195 res->flags |= IORESOURCE_MEM_WRITEABLE;
196
197 res->start = mem;
198 res->end = mem + len - 1;
199 } else if (!warned) {
200 printk(KERN_WARNING "pnpacpi: exceeded the max number of mem "
201 "resources: %d\n", PNP_MAX_MEM);
202 warned = 1;
203 }
204} 188}
205 189
206static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, 190static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev,