[patch 1/2] Staging: vme: remove an unused array

Dan Carpenter dan.carpenter at oracle.com
Fri Jul 6 10:43:02 UTC 2012


On Fri, Jul 06, 2012 at 11:32:51AM +0100, Martyn Welch wrote:
> On 06/07/12 09:15, Dan Carpenter wrote:
> > We don't use the "bus" array or the "bus_num" variable which store the
> > number of elements in the array.  The only user was removed in
> > 5d6abf379d ('staging: vme: make match() driver specific to improve
> > non-VME64x support').
> > 
> 
> Hmm, without a parameter to specify the bus (i.e. a specific vme bridge) to
> which vme_user is to bind, vme_user will bind to all bridges it finds, hogging
> resources on them all.
> 
> Ok, so the current implementation of vme_user can only bind to one bus, so
> it's worse than that, it will only every bind to the first bridge when more
> than one are available.
> 
> It appears that the real problem here is that vme_user_match is wrong.
> 
> Rather than:
> 
> 	static int vme_user_match(struct vme_dev *vdev)
> 	{
> 		if (vdev->num >= VME_USER_BUS_MAX)
> 			return 0;
> 		return 1;
> 	}
> 
> It should be something like:
> 
> 	static int vme_user_match(struct vme_dev *vdev)
> 	{
> 		int i;
> 
> 		for (i = 0; i < VME_USER_BUS_MAX; i++)
> 			if (vdev->num == bus[i])
> 				return 1;
> 		return 0;
> 	}
> 

So the default behavior way should be to bind to the first bus or to
all?

Obviously, we should do your fix.  The problem is that I don't want
to be the one to sign off on something that changes how the code
works when I can't test it.  Can you send for a patch for this?

regards,
dan carpenter





More information about the devel mailing list