Commit e77e2c2f authored by Trent Piepho's avatar Trent Piepho Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (6315): pvrusb2: Change list_for_each+list_entry to list_for_each_entry

parent 6d28e989
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -3458,7 +3458,6 @@ int pvr2_hdw_register_access(struct pvr2_hdw *hdw,
			     int setFl,u64 *val_ptr)
			     int setFl,u64 *val_ptr)
{
{
#ifdef CONFIG_VIDEO_ADV_DEBUG
#ifdef CONFIG_VIDEO_ADV_DEBUG
	struct list_head *item;
	struct pvr2_i2c_client *cp;
	struct pvr2_i2c_client *cp;
	struct v4l2_register req;
	struct v4l2_register req;
	int stat = 0;
	int stat = 0;
@@ -3471,8 +3470,7 @@ int pvr2_hdw_register_access(struct pvr2_hdw *hdw,
	req.reg = reg_id;
	req.reg = reg_id;
	if (setFl) req.val = *val_ptr;
	if (setFl) req.val = *val_ptr;
	mutex_lock(&hdw->i2c_list_lock); do {
	mutex_lock(&hdw->i2c_list_lock); do {
		list_for_each(item,&hdw->i2c_clients) {
		list_for_each_entry(cp, &hdw->i2c_clients, list) {
			cp = list_entry(item,struct pvr2_i2c_client,list);
			if (!v4l2_chip_match_i2c_client(
			if (!v4l2_chip_match_i2c_client(
				    cp->client,
				    cp->client,
				    req.match_type, req.match_chip)) {
				    req.match_type, req.match_chip)) {
+16 −35
Original line number Original line Diff line number Diff line
@@ -570,15 +570,13 @@ int pvr2_i2c_client_cmd(struct pvr2_i2c_client *cp,unsigned int cmd,void *arg)


int pvr2_i2c_core_cmd(struct pvr2_hdw *hdw,unsigned int cmd,void *arg)
int pvr2_i2c_core_cmd(struct pvr2_hdw *hdw,unsigned int cmd,void *arg)
{
{
	struct list_head *item,*nc;
	struct pvr2_i2c_client *cp, *ncp;
	struct pvr2_i2c_client *cp;
	int stat = -EINVAL;
	int stat = -EINVAL;


	if (!hdw) return stat;
	if (!hdw) return stat;


	mutex_lock(&hdw->i2c_list_lock);
	mutex_lock(&hdw->i2c_list_lock);
	list_for_each_safe(item,nc,&hdw->i2c_clients) {
	list_for_each_entry_safe(cp, ncp, &hdw->i2c_clients, list) {
		cp = list_entry(item,struct pvr2_i2c_client,list);
		if (!cp->recv_enable) continue;
		if (!cp->recv_enable) continue;
		mutex_unlock(&hdw->i2c_list_lock);
		mutex_unlock(&hdw->i2c_list_lock);
		stat = pvr2_i2c_client_cmd(cp,cmd,arg);
		stat = pvr2_i2c_client_cmd(cp,cmd,arg);
@@ -602,13 +600,11 @@ static int handler_check(struct pvr2_i2c_client *cp)


void pvr2_i2c_core_status_poll(struct pvr2_hdw *hdw)
void pvr2_i2c_core_status_poll(struct pvr2_hdw *hdw)
{
{
	struct list_head *item;
	struct pvr2_i2c_client *cp;
	struct pvr2_i2c_client *cp;
	mutex_lock(&hdw->i2c_list_lock); do {
	mutex_lock(&hdw->i2c_list_lock); do {
		struct v4l2_tuner *vtp = &hdw->tuner_signal_info;
		struct v4l2_tuner *vtp = &hdw->tuner_signal_info;
		memset(vtp,0,sizeof(*vtp));
		memset(vtp,0,sizeof(*vtp));
		list_for_each(item,&hdw->i2c_clients) {
		list_for_each_entry(cp, &hdw->i2c_clients, list) {
			cp = list_entry(item,struct pvr2_i2c_client,list);
			if (!cp->detected_flag) continue;
			if (!cp->detected_flag) continue;
			if (!cp->status_poll) continue;
			if (!cp->status_poll) continue;
			cp->status_poll(cp);
			cp->status_poll(cp);
@@ -630,8 +626,7 @@ void pvr2_i2c_core_sync(struct pvr2_hdw *hdw)
{
{
	unsigned long msk;
	unsigned long msk;
	unsigned int idx;
	unsigned int idx;
	struct list_head *item,*nc;
	struct pvr2_i2c_client *cp, *ncp;
	struct pvr2_i2c_client *cp;


	if (!hdw->i2c_linked) return;
	if (!hdw->i2c_linked) return;
	if (!(hdw->i2c_pend_types & PVR2_I2C_PEND_ALL)) {
	if (!(hdw->i2c_pend_types & PVR2_I2C_PEND_ALL)) {
@@ -649,9 +644,7 @@ void pvr2_i2c_core_sync(struct pvr2_hdw *hdw)
			buf = kmalloc(BUFSIZE,GFP_KERNEL);
			buf = kmalloc(BUFSIZE,GFP_KERNEL);
			pvr2_trace(PVR2_TRACE_I2C_CORE,"i2c: PEND_DETECT");
			pvr2_trace(PVR2_TRACE_I2C_CORE,"i2c: PEND_DETECT");
			hdw->i2c_pend_types &= ~PVR2_I2C_PEND_DETECT;
			hdw->i2c_pend_types &= ~PVR2_I2C_PEND_DETECT;
			list_for_each(item,&hdw->i2c_clients) {
			list_for_each_entry(cp, &hdw->i2c_clients, list) {
				cp = list_entry(item,struct pvr2_i2c_client,
						list);
				if (!cp->detected_flag) {
				if (!cp->detected_flag) {
					cp->ctl_mask = 0;
					cp->ctl_mask = 0;
					pvr2_i2c_probe(hdw,cp);
					pvr2_i2c_probe(hdw,cp);
@@ -687,9 +680,7 @@ void pvr2_i2c_core_sync(struct pvr2_hdw *hdw)
				   "i2c: PEND_STALE (0x%lx)",
				   "i2c: PEND_STALE (0x%lx)",
				   hdw->i2c_stale_mask);
				   hdw->i2c_stale_mask);
			hdw->i2c_pend_types &= ~PVR2_I2C_PEND_STALE;
			hdw->i2c_pend_types &= ~PVR2_I2C_PEND_STALE;
			list_for_each(item,&hdw->i2c_clients) {
			list_for_each_entry(cp, &hdw->i2c_clients, list) {
				cp = list_entry(item,struct pvr2_i2c_client,
						list);
				m2 = hdw->i2c_stale_mask;
				m2 = hdw->i2c_stale_mask;
				m2 &= cp->ctl_mask;
				m2 &= cp->ctl_mask;
				m2 &= ~cp->pend_mask;
				m2 &= ~cp->pend_mask;
@@ -710,9 +701,8 @@ void pvr2_i2c_core_sync(struct pvr2_hdw *hdw)
			   and update each one. */
			   and update each one. */
			pvr2_trace(PVR2_TRACE_I2C_CORE,"i2c: PEND_CLIENT");
			pvr2_trace(PVR2_TRACE_I2C_CORE,"i2c: PEND_CLIENT");
			hdw->i2c_pend_types &= ~PVR2_I2C_PEND_CLIENT;
			hdw->i2c_pend_types &= ~PVR2_I2C_PEND_CLIENT;
			list_for_each_safe(item,nc,&hdw->i2c_clients) {
			list_for_each_entry_safe(cp, ncp, &hdw->i2c_clients,
				cp = list_entry(item,struct pvr2_i2c_client,
						 list) {
						list);
				if (!cp->handler) continue;
				if (!cp->handler) continue;
				if (!cp->handler->func_table->update) continue;
				if (!cp->handler->func_table->update) continue;
				pvr2_trace(PVR2_TRACE_I2C_CORE,
				pvr2_trace(PVR2_TRACE_I2C_CORE,
@@ -744,10 +734,8 @@ void pvr2_i2c_core_sync(struct pvr2_hdw *hdw)
			for (idx = 0, msk = 1; pm; idx++, msk <<= 1) {
			for (idx = 0, msk = 1; pm; idx++, msk <<= 1) {
				if (!(pm & msk)) continue;
				if (!(pm & msk)) continue;
				pm &= ~msk;
				pm &= ~msk;
				list_for_each(item,&hdw->i2c_clients) {
				list_for_each_entry(cp, &hdw->i2c_clients,
					cp = list_entry(item,
						    list) {
							struct pvr2_i2c_client,
							list);
					if (cp->pend_mask & msk) {
					if (cp->pend_mask & msk) {
						cp->pend_mask &= ~msk;
						cp->pend_mask &= ~msk;
						cp->recv_enable = !0;
						cp->recv_enable = !0;
@@ -771,7 +759,6 @@ int pvr2_i2c_core_check_stale(struct pvr2_hdw *hdw)
	unsigned long msk,sm,pm;
	unsigned long msk,sm,pm;
	unsigned int idx;
	unsigned int idx;
	const struct pvr2_i2c_op *opf;
	const struct pvr2_i2c_op *opf;
	struct list_head *item;
	struct pvr2_i2c_client *cp;
	struct pvr2_i2c_client *cp;
	unsigned int pt = 0;
	unsigned int pt = 0;


@@ -790,11 +777,9 @@ int pvr2_i2c_core_check_stale(struct pvr2_hdw *hdw)
	}
	}
	if (sm) pt |= PVR2_I2C_PEND_STALE;
	if (sm) pt |= PVR2_I2C_PEND_STALE;


	list_for_each(item,&hdw->i2c_clients) {
	list_for_each_entry(cp, &hdw->i2c_clients, list)
		cp = list_entry(item,struct pvr2_i2c_client,list);
		if (handler_check(cp))
		if (!handler_check(cp)) continue;
			pt |= PVR2_I2C_PEND_CLIENT;
			pt |= PVR2_I2C_PEND_CLIENT;
	}


	if (pt) {
	if (pt) {
		mutex_lock(&hdw->i2c_list_lock); do {
		mutex_lock(&hdw->i2c_list_lock); do {
@@ -882,12 +867,10 @@ unsigned int pvr2_i2c_report(struct pvr2_hdw *hdw,
			     char *buf,unsigned int maxlen)
			     char *buf,unsigned int maxlen)
{
{
	unsigned int ccnt,bcnt;
	unsigned int ccnt,bcnt;
	struct list_head *item;
	struct pvr2_i2c_client *cp;
	struct pvr2_i2c_client *cp;
	ccnt = 0;
	ccnt = 0;
	mutex_lock(&hdw->i2c_list_lock); do {
	mutex_lock(&hdw->i2c_list_lock); do {
		list_for_each(item,&hdw->i2c_clients) {
		list_for_each_entry(cp, &hdw->i2c_clients, list) {
			cp = list_entry(item,struct pvr2_i2c_client,list);
			bcnt = pvr2_i2c_client_describe(
			bcnt = pvr2_i2c_client_describe(
				cp,
				cp,
				(PVR2_I2C_DETAIL_HANDLER|
				(PVR2_I2C_DETAIL_HANDLER|
@@ -925,13 +908,11 @@ static int pvr2_i2c_attach_inform(struct i2c_client *client)
static int pvr2_i2c_detach_inform(struct i2c_client *client)
static int pvr2_i2c_detach_inform(struct i2c_client *client)
{
{
	struct pvr2_hdw *hdw = (struct pvr2_hdw *)(client->adapter->algo_data);
	struct pvr2_hdw *hdw = (struct pvr2_hdw *)(client->adapter->algo_data);
	struct pvr2_i2c_client *cp;
	struct pvr2_i2c_client *cp, *ncp;
	struct list_head *item,*nc;
	unsigned long amask = 0;
	unsigned long amask = 0;
	int foundfl = 0;
	int foundfl = 0;
	mutex_lock(&hdw->i2c_list_lock); do {
	mutex_lock(&hdw->i2c_list_lock); do {
		list_for_each_safe(item,nc,&hdw->i2c_clients) {
		list_for_each_entry_safe(cp, ncp, &hdw->i2c_clients, list) {
			cp = list_entry(item,struct pvr2_i2c_client,list);
			if (cp->client == client) {
			if (cp->client == client) {
				trace_i2c("pvr2_i2c_detach"
				trace_i2c("pvr2_i2c_detach"
					  " [client=%s @ 0x%x ctxt=%p]",
					  " [client=%s @ 0x%x ctxt=%p]",