A
Anuz
Hi all,
While compiling a driver, I am getting this error:
error: dereferencing pointer to incomplete type
int __kc_adapter_clean(struct net_device *netdev, int *budget)
{
/*some initialization stuff */
struct adapter_struct *adapter = netdev_priv(netdev);
struct napi_struct *napi = &adapter->rx_ring[0].napi; /*
<<<<<<<<<<<the error is on this line */
/* some other function stuff */
}
struct adapter_struct is defined as:
#define adapter_struct e1000_adapter
which is defined as:
struct e1000_adapter {
/* other members */
struct e1000_rx_ring *rx_ring;
/* other members */
};
struct e1000_rx_ring {
struct e1000_adapter *adapter;
#ifdef CONFIG_E1000_NAPI
struct napi_struct napi;
#endif
/* other members */
};
For netdev_priv() either the macro or the inline function is used:
#define netdev_priv(x) x->priv
OR
static inline void *netdev_priv(struct net_device *dev)
{
return (char *)dev + ((sizeof(struct net_device)
+ NETDEV_ALIGN_CONST)
& ~NETDEV_ALIGN_CONST);
}
struct net_device
{
void *priv;
/* other data */
}
In the particular line "&adapter->rx_ring[0].napi", after macro
substitution, dereferencing is not done in correct way, but I am not
able to figure out exactly where and how. I have tried casting the
void * part to particular struct type but, even that doesn't eliminate
the problem.
I think I have already provided all info related, if anything is
missing please point out.
I have looked for the problem around on net, couldn't find same thing,
so if this question is asked elsewhere please point to the same and I
apologize for adding the noise.
I think that problem is more of typical C compilation problem, so I
have assumed that this community is most relevant for asking this
question.
I apologize if I have unknowingly violated any community rule.
Thanks
Regards
Anuz
While compiling a driver, I am getting this error:
error: dereferencing pointer to incomplete type
int __kc_adapter_clean(struct net_device *netdev, int *budget)
{
/*some initialization stuff */
struct adapter_struct *adapter = netdev_priv(netdev);
struct napi_struct *napi = &adapter->rx_ring[0].napi; /*
<<<<<<<<<<<the error is on this line */
/* some other function stuff */
}
struct adapter_struct is defined as:
#define adapter_struct e1000_adapter
which is defined as:
struct e1000_adapter {
/* other members */
struct e1000_rx_ring *rx_ring;
/* other members */
};
struct e1000_rx_ring {
struct e1000_adapter *adapter;
#ifdef CONFIG_E1000_NAPI
struct napi_struct napi;
#endif
/* other members */
};
For netdev_priv() either the macro or the inline function is used:
#define netdev_priv(x) x->priv
OR
static inline void *netdev_priv(struct net_device *dev)
{
return (char *)dev + ((sizeof(struct net_device)
+ NETDEV_ALIGN_CONST)
& ~NETDEV_ALIGN_CONST);
}
struct net_device
{
void *priv;
/* other data */
}
In the particular line "&adapter->rx_ring[0].napi", after macro
substitution, dereferencing is not done in correct way, but I am not
able to figure out exactly where and how. I have tried casting the
void * part to particular struct type but, even that doesn't eliminate
the problem.
I think I have already provided all info related, if anything is
missing please point out.
I have looked for the problem around on net, couldn't find same thing,
so if this question is asked elsewhere please point to the same and I
apologize for adding the noise.
I think that problem is more of typical C compilation problem, so I
have assumed that this community is most relevant for asking this
question.
I apologize if I have unknowingly violated any community rule.
Thanks
Regards
Anuz