Skip to content

Commit 52807ae

Browse files
arndbvinceab
authored andcommitted
drm/sti: use u32 to store DMA addresses
The STi drm driver correctly warns about invalid format strings when built with 64-bit dma_addr_t: sti_hqvdp.c: In function 'sti_hqvdp_vtg_cb': sti_hqvdp.c:605:119: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'dma_addr_t {aka long long unsigned int}' [-Wformat=] sti_hqvdp.c: In function 'sti_hqvdp_atomic_update': sti_hqvdp.c:931:118: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'dma_addr_t {aka long long unsigned int}' [-Wformat=] This could be changed to using the %pad format string, but that does not work when printing an rvalue, so instead I'm changing the type in the sti_hqvdp structure to u32, which is what gets written into the registers anyway. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Vincent Abriou <vincent.abriou@st.com>
1 parent ffd157c commit 52807ae

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/gpu/drm/sti/sti_hqvdp.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ struct sti_hqvdp {
342342
struct notifier_block vtg_nb;
343343
bool btm_field_pending;
344344
void *hqvdp_cmd;
345-
dma_addr_t hqvdp_cmd_paddr;
345+
u32 hqvdp_cmd_paddr;
346346
struct sti_vtg *vtg;
347347
bool xp70_initialized;
348348
};
@@ -365,8 +365,8 @@ static const uint32_t hqvdp_supported_formats[] = {
365365
*/
366366
static int sti_hqvdp_get_free_cmd(struct sti_hqvdp *hqvdp)
367367
{
368-
int curr_cmd, next_cmd;
369-
dma_addr_t cmd = hqvdp->hqvdp_cmd_paddr;
368+
u32 curr_cmd, next_cmd;
369+
u32 cmd = hqvdp->hqvdp_cmd_paddr;
370370
int i;
371371

372372
curr_cmd = readl(hqvdp->regs + HQVDP_MBX_CURRENT_CMD);
@@ -393,8 +393,8 @@ static int sti_hqvdp_get_free_cmd(struct sti_hqvdp *hqvdp)
393393
*/
394394
static int sti_hqvdp_get_curr_cmd(struct sti_hqvdp *hqvdp)
395395
{
396-
int curr_cmd;
397-
dma_addr_t cmd = hqvdp->hqvdp_cmd_paddr;
396+
u32 curr_cmd;
397+
u32 cmd = hqvdp->hqvdp_cmd_paddr;
398398
unsigned int i;
399399

400400
curr_cmd = readl(hqvdp->regs + HQVDP_MBX_CURRENT_CMD);
@@ -846,19 +846,21 @@ int sti_hqvdp_vtg_cb(struct notifier_block *nb, unsigned long evt, void *data)
846846
static void sti_hqvdp_init(struct sti_hqvdp *hqvdp)
847847
{
848848
int size;
849+
dma_addr_t dma_addr;
849850

850851
hqvdp->vtg_nb.notifier_call = sti_hqvdp_vtg_cb;
851852

852853
/* Allocate memory for the VDP commands */
853854
size = NB_VDP_CMD * sizeof(struct sti_hqvdp_cmd);
854855
hqvdp->hqvdp_cmd = dma_alloc_writecombine(hqvdp->dev, size,
855-
&hqvdp->hqvdp_cmd_paddr,
856+
&dma_addr,
856857
GFP_KERNEL | GFP_DMA);
857858
if (!hqvdp->hqvdp_cmd) {
858859
DRM_ERROR("Failed to allocate memory for VDP cmd\n");
859860
return;
860861
}
861862

863+
hqvdp->hqvdp_cmd_paddr = (u32)dma_addr;
862864
memset(hqvdp->hqvdp_cmd, 0, size);
863865
}
864866

0 commit comments

Comments
 (0)