linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Greg KH <greg@kroah.com>
Cc: Linux Next Mailing List <linux-next@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Jiri Slaby <jslaby@suse.cz>
Subject: linux-next: manual merge of the tty tree with Linus' tree
Date: Tue, 10 Mar 2020 14:40:13 +1100	[thread overview]
Message-ID: <20200310144013.6df85b46@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 6794 bytes --]

Hi all,

Today's linux-next merge of the tty tree got a conflict in:

  drivers/tty/vt/selection.c

between commits:

  4b70dd57a15d ("vt: selection, push console lock down")
  e8c75a30a23c ("vt: selection, push sel_lock up")

from Linus' tree and commits:

  9256d09f1da1 ("vt: selection, create struct from console selection globals")
  bc80932cc25a ("vt: selection, indent switch-case properly")

from the tty tree.

I fixed it up (I think - see below) and can carry the fix as necessary.
This is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

cdc26c076ff74acec5113c5234093eae54954761
diff --cc drivers/tty/vt/selection.c
index d7d2e4b844bc,b9c517463efa..582184dd386c
--- a/drivers/tty/vt/selection.c
+++ b/drivers/tty/vt/selection.c
@@@ -211,57 -216,53 +216,51 @@@ static int __set_selection_kernel(struc
  		return 0;
  	}
  
- 	if (ps > pe)	/* make sel_start <= sel_end */
+ 	if (ps > pe)	/* make vc_sel.start <= vc_sel.end */
  		swap(ps, pe);
  
- 	if (sel_cons != vc_cons[fg_console].d) {
 -	mutex_lock(&vc_sel.lock);
+ 	if (vc_sel.cons != vc_cons[fg_console].d) {
  		clear_selection();
- 		sel_cons = vc_cons[fg_console].d;
+ 		vc_sel.cons = vc_cons[fg_console].d;
  	}
- 	mode = vt_do_kdgkbmode(fg_console);
- 	if (mode == K_UNICODE)
- 		use_unicode = 1;
- 	else
- 		use_unicode = 0;
- 
- 	switch (v->sel_mode)
- 	{
- 		case TIOCL_SELCHAR:	/* character-by-character selection */
+ 	unicode = vt_do_kdgkbmode(fg_console) == K_UNICODE;
+ 
+ 	switch (v->sel_mode) {
+ 	case TIOCL_SELCHAR:	/* character-by-character selection */
+ 		new_sel_start = ps;
+ 		new_sel_end = pe;
+ 		break;
+ 	case TIOCL_SELWORD:	/* word-by-word selection */
+ 		spc = isspace(sel_pos(ps, unicode));
+ 		for (new_sel_start = ps; ; ps -= 2) {
+ 			if ((spc && !isspace(sel_pos(ps, unicode))) ||
+ 			    (!spc && !inword(sel_pos(ps, unicode))))
+ 				break;
  			new_sel_start = ps;
+ 			if (!(ps % vc->vc_size_row))
+ 				break;
+ 		}
+ 
+ 		spc = isspace(sel_pos(pe, unicode));
+ 		for (new_sel_end = pe; ; pe += 2) {
+ 			if ((spc && !isspace(sel_pos(pe, unicode))) ||
+ 			    (!spc && !inword(sel_pos(pe, unicode))))
+ 				break;
  			new_sel_end = pe;
- 			break;
- 		case TIOCL_SELWORD:	/* word-by-word selection */
- 			spc = isspace(sel_pos(ps));
- 			for (new_sel_start = ps; ; ps -= 2)
- 			{
- 				if ((spc && !isspace(sel_pos(ps))) ||
- 				    (!spc && !inword(sel_pos(ps))))
- 					break;
- 				new_sel_start = ps;
- 				if (!(ps % vc->vc_size_row))
- 					break;
- 			}
- 			spc = isspace(sel_pos(pe));
- 			for (new_sel_end = pe; ; pe += 2)
- 			{
- 				if ((spc && !isspace(sel_pos(pe))) ||
- 				    (!spc && !inword(sel_pos(pe))))
- 					break;
- 				new_sel_end = pe;
- 				if (!((pe + 2) % vc->vc_size_row))
- 					break;
- 			}
- 			break;
- 		case TIOCL_SELLINE:	/* line-by-line selection */
- 			new_sel_start = ps - ps % vc->vc_size_row;
- 			new_sel_end = pe + vc->vc_size_row
- 				    - pe % vc->vc_size_row - 2;
- 			break;
- 		case TIOCL_SELPOINTER:
- 			highlight_pointer(pe);
- 			return 0;
- 		default:
- 			return -EINVAL;
+ 			if (!((pe + 2) % vc->vc_size_row))
+ 				break;
+ 		}
+ 		break;
+ 	case TIOCL_SELLINE:	/* line-by-line selection */
+ 		new_sel_start = ps - ps % vc->vc_size_row;
+ 		new_sel_end = pe + vc->vc_size_row
+ 			    - pe % vc->vc_size_row - 2;
+ 		break;
+ 	case TIOCL_SELPOINTER:
+ 		highlight_pointer(pe);
 -		goto unlock;
++		return 0;
+ 	default:
 -		ret = -EINVAL;
 -		goto unlock;
++		return -EINVAL;
  	}
  
  	/* remove the pointer */
@@@ -270,31 -271,31 +269,31 @@@
  	/* select to end of line if on trailing space */
  	if (new_sel_end > new_sel_start &&
  		!atedge(new_sel_end, vc->vc_size_row) &&
- 		isspace(sel_pos(new_sel_end))) {
+ 		isspace(sel_pos(new_sel_end, unicode))) {
  		for (pe = new_sel_end + 2; ; pe += 2)
- 			if (!isspace(sel_pos(pe)) ||
+ 			if (!isspace(sel_pos(pe, unicode)) ||
  			    atedge(pe, vc->vc_size_row))
  				break;
- 		if (isspace(sel_pos(pe)))
+ 		if (isspace(sel_pos(pe, unicode)))
  			new_sel_end = pe;
  	}
- 	if (sel_start == -1)	/* no current selection */
+ 	if (vc_sel.start == -1)	/* no current selection */
  		highlight(new_sel_start, new_sel_end);
- 	else if (new_sel_start == sel_start)
+ 	else if (new_sel_start == vc_sel.start)
  	{
- 		if (new_sel_end == sel_end)	/* no action required */
+ 		if (new_sel_end == vc_sel.end)	/* no action required */
 -			goto unlock;
 +			return 0;
- 		else if (new_sel_end > sel_end)	/* extend to right */
- 			highlight(sel_end + 2, new_sel_end);
+ 		else if (new_sel_end > vc_sel.end)	/* extend to right */
+ 			highlight(vc_sel.end + 2, new_sel_end);
  		else				/* contract from right */
- 			highlight(new_sel_end + 2, sel_end);
+ 			highlight(new_sel_end + 2, vc_sel.end);
  	}
- 	else if (new_sel_end == sel_end)
+ 	else if (new_sel_end == vc_sel.end)
  	{
- 		if (new_sel_start < sel_start)	/* extend to left */
- 			highlight(new_sel_start, sel_start - 2);
+ 		if (new_sel_start < vc_sel.start) /* extend to left */
+ 			highlight(new_sel_start, vc_sel.start - 2);
  		else				/* contract from left */
- 			highlight(sel_start, new_sel_start - 2);
+ 			highlight(vc_sel.start, new_sel_start - 2);
  	}
  	else	/* some other case; start selection from scratch */
  	{
@@@ -311,15 -312,16 +310,15 @@@
  	if (!bp) {
  		printk(KERN_WARNING "selection: kmalloc() failed\n");
  		clear_selection();
 -		ret = -ENOMEM;
 -		goto unlock;
 +		return -ENOMEM;
  	}
- 	kfree(sel_buffer);
- 	sel_buffer = bp;
+ 	kfree(vc_sel.buffer);
+ 	vc_sel.buffer = bp;
  
  	obp = bp;
- 	for (i = sel_start; i <= sel_end; i += 2) {
- 		c = sel_pos(i);
- 		if (use_unicode)
+ 	for (i = vc_sel.start; i <= vc_sel.end; i += 2) {
+ 		c = sel_pos(i, unicode);
+ 		if (unicode)
  			bp += store_utf8(c, bp);
  		else
  			*bp++ = c;
@@@ -335,21 -337,9 +334,21 @@@
  			obp = bp;
  		}
  	}
- 	sel_buffer_lth = bp - sel_buffer;
+ 	vc_sel.buf_len = bp - vc_sel.buffer;
 -unlock:
 +
 +	return ret;
 +}
 +
 +int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
 +{
 +	int ret;
 +
- 	mutex_lock(&sel_lock);
++	mutex_lock(&vc_sel.lock);
 +	console_lock();
 +	ret = __set_selection_kernel(v, tty);
 +	console_unlock();
- 	mutex_unlock(&sel_lock);
+ 	mutex_unlock(&vc_sel.lock);
 +
  	return ret;
  }
  EXPORT_SYMBOL_GPL(set_selection_kernel);

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2020-03-10  3:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-10  3:40 Stephen Rothwell [this message]
2020-03-10  9:04 ` linux-next: manual merge of the tty tree with Linus' tree Greg KH
2020-03-10 10:52   ` Jiri Slaby
2020-03-16  6:38   ` Jiri Slaby
2020-03-16  7:46     ` Greg KH
2020-03-16  6:34 ` Jiri Slaby
  -- strict thread matches above, loose matches on Subject: below --
2016-05-20  2:31 Stephen Rothwell
2016-05-21  3:26 ` Greg KH
2014-05-05  5:41 Stephen Rothwell
2014-05-05 21:02 ` Greg KH
2013-01-21  3:46 Stephen Rothwell
2013-01-21 21:02 ` Greg KH
2013-01-25 20:57 ` Greg KH
2013-01-17  2:04 Stephen Rothwell
2013-01-18  0:41 ` Greg KH
2011-10-25  8:18 Stephen Rothwell
2011-10-25 10:03 ` Nicolas Ferre
2011-10-25  8:12 Stephen Rothwell
2011-10-25 12:02 ` Greg KH
2011-02-24  5:34 Stephen Rothwell
2011-02-24 19:39 ` Greg KH
2011-02-25  5:11   ` Stephen Rothwell
2011-02-25  5:48     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200310144013.6df85b46@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=greg@kroah.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).