LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-18-2013, 04:56 AM   #1
answerme
Member
 
Registered: Apr 2008
Posts: 97

Rep: Reputation: 24
error: dereferencing pointer to incomplete type


Hi All
I got an eval board MPC8641
I want to access one register for that


Code:
yy.c
unsigned long __iomem *devdisr;

devdisr=ioremap(get_immrbase() + 0xE0070,0x100);
	if(!devdisr) {
		return -ENOMEM;
	}

out_be32(devdisr,0x3000000);
reg_value=in_be32(devdisr);
printk(KERN_INFO " devdisr reg_value:  0x%x  \r\n",reg_value);
Here above Iam getting output BUT when I am accessing with structure I am getting error

Code:
xx.h file 
typedef struct ccsr_guts {
	uint	devdisr;
} ccsr_guts_t;
Code:
yy.c file 

struct  ccsr_guts __iomem *gur;
reg_value=in_be32(&gur->devdisr);
Iam getting error error: dereferencing pointer to incomplete type
Dont know how to resolve this problem

Last edited by answerme; 09-18-2013 at 04:57 AM.
 
Old 09-18-2013, 05:00 AM   #2
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
try changing
reg_value=in_be32(&gur->devdisr);
to
reg_value=in_be32(gur->devdisr);
since gur is already a pointer and taking the address of it might not be good
 
Old 09-18-2013, 05:19 AM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,869
Blog Entries: 1

Rep: Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870
add this line to yy.c:

Code:
#include "xx.h"
Also you should edit xx.h:

Code:
typedef struct ccsr_guts {
	uint	devdisr;
} ccsr_guts;
meaning: don't use two names for one thing.
 
Old 09-18-2013, 05:34 AM   #4
answerme
Member
 
Registered: Apr 2008
Posts: 97

Original Poster
Rep: Reputation: 24
I have tried it already above 2 solution which NevemTeve & a4z has given but still same problem existing

& its not ccsr_guts its ccsr_guts_t if see above again .ANY OTHER SOLUTIONS
 
Old 09-18-2013, 05:45 AM   #5
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,869
Blog Entries: 1

Rep: Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870
quote more code. example:

xx.h
Code:
/* xx.h */

#ifndef xx_h
#define xx_h

typedef struct ccsr_guts {
    unsigned devdisr;
} ccsr_guts;

#endif
yy.c
Code:
/* yy.c */

#include <stdio.h>

#include "xx.h"

int main (void)
{
    struct ccsr_guts gur;
    struct ccsr_guts *gurp= &gur;

    printf ("&gur->devdisr=%p\n", &gurp->devdisr);
    return 0;
}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
error: dereferencing pointer to incomplete type joyce092130 Programming 11 09-29-2012 09:06 AM
error: dereferencing pointer to incomplete type joyce092130 Programming 1 07-07-2012 09:57 AM
[SOLVED] error: dereferencing pointer to incomplete type in C Himalay Programming 9 07-07-2012 08:35 AM
error: dereferencing pointer to incomplete type ChullDouvre Programming 2 05-02-2007 12:16 AM
Error: dereferencing pointer to incomplete type cynthia_thomas Programming 1 05-01-2006 08:10 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration