Skip to content

Commit 5bc4418

Browse files
bwidawskdanvet
authored andcommitted
drm/i915: [sparse] __iomem fixes for opregion
Almost all of the errors related __iomem problems. Most of the changes here are trivial, however there is plenty of chance for yank/paste errors. Signed-off-by: Ben Widawsky <[email protected]> Signed-off-by: Daniel Vetter <[email protected]>
1 parent 92d68ed commit 5bc4418

File tree

2 files changed

+43
-34
lines changed

2 files changed

+43
-34
lines changed

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ struct opregion_asle;
122122
struct drm_i915_private;
123123

124124
struct intel_opregion {
125-
struct opregion_header *header;
126-
struct opregion_acpi *acpi;
127-
struct opregion_swsci *swsci;
128-
struct opregion_asle *asle;
129-
void *vbt;
125+
struct opregion_header __iomem *header;
126+
struct opregion_acpi __iomem *acpi;
127+
struct opregion_swsci __iomem *swsci;
128+
struct opregion_asle __iomem *asle;
129+
void __iomem *vbt;
130130
u32 __iomem *lid_state;
131131
};
132132
#define OPREGION_SIZE (8*1024)

drivers/gpu/drm/i915/intel_opregion.c

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ struct opregion_asle {
151151
static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
152152
{
153153
struct drm_i915_private *dev_priv = dev->dev_private;
154-
struct opregion_asle *asle = dev_priv->opregion.asle;
154+
struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
155155
u32 max;
156156

157157
if (!(bclp & ASLE_BCLP_VALID))
@@ -163,7 +163,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
163163

164164
max = intel_panel_get_max_backlight(dev);
165165
intel_panel_set_backlight(dev, bclp * max / 255);
166-
asle->cblv = (bclp*0x64)/0xff | ASLE_CBLV_VALID;
166+
iowrite32((bclp*0x64)/0xff | ASLE_CBLV_VALID, &asle->cblv);
167167

168168
return 0;
169169
}
@@ -200,46 +200,46 @@ static u32 asle_set_pfit(struct drm_device *dev, u32 pfit)
200200
void intel_opregion_asle_intr(struct drm_device *dev)
201201
{
202202
struct drm_i915_private *dev_priv = dev->dev_private;
203-
struct opregion_asle *asle = dev_priv->opregion.asle;
203+
struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
204204
u32 asle_stat = 0;
205205
u32 asle_req;
206206

207207
if (!asle)
208208
return;
209209

210-
asle_req = asle->aslc & ASLE_REQ_MSK;
210+
asle_req = ioread32(&asle->aslc) & ASLE_REQ_MSK;
211211

212212
if (!asle_req) {
213213
DRM_DEBUG_DRIVER("non asle set request??\n");
214214
return;
215215
}
216216

217217
if (asle_req & ASLE_SET_ALS_ILLUM)
218-
asle_stat |= asle_set_als_illum(dev, asle->alsi);
218+
asle_stat |= asle_set_als_illum(dev, ioread32(&asle->alsi));
219219

220220
if (asle_req & ASLE_SET_BACKLIGHT)
221-
asle_stat |= asle_set_backlight(dev, asle->bclp);
221+
asle_stat |= asle_set_backlight(dev, ioread32(&asle->bclp));
222222

223223
if (asle_req & ASLE_SET_PFIT)
224-
asle_stat |= asle_set_pfit(dev, asle->pfit);
224+
asle_stat |= asle_set_pfit(dev, ioread32(&asle->pfit));
225225

226226
if (asle_req & ASLE_SET_PWM_FREQ)
227-
asle_stat |= asle_set_pwm_freq(dev, asle->pfmb);
227+
asle_stat |= asle_set_pwm_freq(dev, ioread32(&asle->pfmb));
228228

229-
asle->aslc = asle_stat;
229+
iowrite32(asle_stat, &asle->aslc);
230230
}
231231

232232
void intel_opregion_gse_intr(struct drm_device *dev)
233233
{
234234
struct drm_i915_private *dev_priv = dev->dev_private;
235-
struct opregion_asle *asle = dev_priv->opregion.asle;
235+
struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
236236
u32 asle_stat = 0;
237237
u32 asle_req;
238238

239239
if (!asle)
240240
return;
241241

242-
asle_req = asle->aslc & ASLE_REQ_MSK;
242+
asle_req = ioread32(&asle->aslc) & ASLE_REQ_MSK;
243243

244244
if (!asle_req) {
245245
DRM_DEBUG_DRIVER("non asle set request??\n");
@@ -252,7 +252,7 @@ void intel_opregion_gse_intr(struct drm_device *dev)
252252
}
253253

254254
if (asle_req & ASLE_SET_BACKLIGHT)
255-
asle_stat |= asle_set_backlight(dev, asle->bclp);
255+
asle_stat |= asle_set_backlight(dev, ioread32(&asle->bclp));
256256

257257
if (asle_req & ASLE_SET_PFIT) {
258258
DRM_DEBUG_DRIVER("Pfit is not supported\n");
@@ -264,7 +264,7 @@ void intel_opregion_gse_intr(struct drm_device *dev)
264264
asle_stat |= ASLE_PWM_FREQ_FAILED;
265265
}
266266

267-
asle->aslc = asle_stat;
267+
iowrite32(asle_stat, &asle->aslc);
268268
}
269269
#define ASLE_ALS_EN (1<<0)
270270
#define ASLE_BLC_EN (1<<1)
@@ -274,15 +274,16 @@ void intel_opregion_gse_intr(struct drm_device *dev)
274274
void intel_opregion_enable_asle(struct drm_device *dev)
275275
{
276276
struct drm_i915_private *dev_priv = dev->dev_private;
277-
struct opregion_asle *asle = dev_priv->opregion.asle;
277+
struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
278278

279279
if (asle) {
280280
if (IS_MOBILE(dev))
281281
intel_enable_asle(dev);
282282

283-
asle->tche = ASLE_ALS_EN | ASLE_BLC_EN | ASLE_PFIT_EN |
284-
ASLE_PFMB_EN;
285-
asle->ardy = 1;
283+
iowrite32(ASLE_ALS_EN | ASLE_BLC_EN | ASLE_PFIT_EN |
284+
ASLE_PFMB_EN,
285+
&asle->tche);
286+
iowrite32(1, &asle->ardy);
286287
}
287288
}
288289

@@ -300,7 +301,7 @@ static int intel_opregion_video_event(struct notifier_block *nb,
300301
Linux, these are handled by the dock, button and video drivers.
301302
*/
302303

303-
struct opregion_acpi *acpi;
304+
struct opregion_acpi __iomem *acpi;
304305
struct acpi_bus_event *event = data;
305306
int ret = NOTIFY_OK;
306307

@@ -312,10 +313,11 @@ static int intel_opregion_video_event(struct notifier_block *nb,
312313

313314
acpi = system_opregion->acpi;
314315

315-
if (event->type == 0x80 && !(acpi->cevt & 0x1))
316+
if (event->type == 0x80 &&
317+
(ioread32(&acpi->cevt) & 1) == 0)
316318
ret = NOTIFY_BAD;
317319

318-
acpi->csts = 0;
320+
iowrite32(0, &acpi->csts);
319321

320322
return ret;
321323
}
@@ -339,6 +341,7 @@ static void intel_didl_outputs(struct drm_device *dev)
339341
struct acpi_device *acpi_dev, *acpi_cdev, *acpi_video_bus = NULL;
340342
unsigned long long device_id;
341343
acpi_status status;
344+
u32 temp;
342345
int i = 0;
343346

344347
handle = DEVICE_ACPI_HANDLE(&dev->pdev->dev);
@@ -373,15 +376,16 @@ static void intel_didl_outputs(struct drm_device *dev)
373376
if (ACPI_SUCCESS(status)) {
374377
if (!device_id)
375378
goto blind_set;
376-
opregion->acpi->didl[i] = (u32)(device_id & 0x0f0f);
379+
iowrite32((u32)(device_id & 0x0f0f),
380+
&opregion->acpi->didl[i]);
377381
i++;
378382
}
379383
}
380384

381385
end:
382386
/* If fewer than 8 outputs, the list must be null terminated */
383387
if (i < 8)
384-
opregion->acpi->didl[i] = 0;
388+
iowrite32(0, &opregion->acpi->didl[i]);
385389
return;
386390

387391
blind_set:
@@ -415,7 +419,9 @@ static void intel_didl_outputs(struct drm_device *dev)
415419
output_type = ACPI_LVDS_OUTPUT;
416420
break;
417421
}
418-
opregion->acpi->didl[i] |= (1<<31) | output_type | i;
422+
temp = ioread32(&opregion->acpi->didl[i]);
423+
iowrite32(temp | (1<<31) | output_type | i,
424+
&opregion->acpi->didl[i]);
419425
i++;
420426
}
421427
goto end;
@@ -436,8 +442,8 @@ void intel_opregion_init(struct drm_device *dev)
436442
/* Notify BIOS we are ready to handle ACPI video ext notifs.
437443
* Right now, all the events are handled by the ACPI video module.
438444
* We don't actually need to do anything with them. */
439-
opregion->acpi->csts = 0;
440-
opregion->acpi->drdy = 1;
445+
iowrite32(0, &opregion->acpi->csts);
446+
iowrite32(1, &opregion->acpi->drdy);
441447

442448
system_opregion = opregion;
443449
register_acpi_notifier(&intel_opregion_notifier);
@@ -456,7 +462,7 @@ void intel_opregion_fini(struct drm_device *dev)
456462
return;
457463

458464
if (opregion->acpi) {
459-
opregion->acpi->drdy = 0;
465+
iowrite32(0, &opregion->acpi->drdy);
460466

461467
system_opregion = NULL;
462468
unregister_acpi_notifier(&intel_opregion_notifier);
@@ -476,8 +482,9 @@ int intel_opregion_setup(struct drm_device *dev)
476482
{
477483
struct drm_i915_private *dev_priv = dev->dev_private;
478484
struct intel_opregion *opregion = &dev_priv->opregion;
479-
void *base;
485+
void __iomem *base;
480486
u32 asls, mboxes;
487+
char buf[sizeof(OPREGION_SIGNATURE)];
481488
int err = 0;
482489

483490
pci_read_config_dword(dev->pdev, PCI_ASLS, &asls);
@@ -491,7 +498,9 @@ int intel_opregion_setup(struct drm_device *dev)
491498
if (!base)
492499
return -ENOMEM;
493500

494-
if (memcmp(base, OPREGION_SIGNATURE, 16)) {
501+
memcpy_fromio(buf, base, sizeof(buf));
502+
503+
if (memcmp(buf, OPREGION_SIGNATURE, 16)) {
495504
DRM_DEBUG_DRIVER("opregion signature mismatch\n");
496505
err = -EINVAL;
497506
goto err_out;
@@ -501,7 +510,7 @@ int intel_opregion_setup(struct drm_device *dev)
501510

502511
opregion->lid_state = base + ACPI_CLID;
503512

504-
mboxes = opregion->header->mboxes;
513+
mboxes = ioread32(&opregion->header->mboxes);
505514
if (mboxes & MBOX_ACPI) {
506515
DRM_DEBUG_DRIVER("Public ACPI methods supported\n");
507516
opregion->acpi = base + OPREGION_ACPI_OFFSET;

0 commit comments

Comments
 (0)