kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: gregkh@linuxfoundation.org (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: [PATCH] reformat_with_checkpatch: Add automation to checkpatch
Date: Sat, 12 Jul 2014 01:18:37 -0700	[thread overview]
Message-ID: <20140712081837.GA28704@kroah.com> (raw)
In-Reply-To: <1405128087.6751.12.camel@joe-AO725>

On Fri, Jul 11, 2014 at 06:21:27PM -0700, Joe Perches wrote:
> A simple script to run checkpatch --fix for various types of
> of cleanups.
> 
> This script is useful primarily for staging.
> 
> This reformats code to a more CodingStyle conforming style,
> compiles it, verifies that the object code hasn't changed,
> and git commits it too.
> 
> You must have the necessary development tools, git, and a
> recent git tree.  Ideally use Greg KH's staging-next, which
> can be retrieved via these commands:
> 
> git clone git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
> git checkout staging-next
> 
> To use this script try a sequence of commands like:
> 
> 	cd <linux_repository>
> 	git checkout -b <your_branch>
> 	make allyesconfig
> 	mkdir patches
> 	./scripts/reformat_with_checkpatch.sh drivers/staging/<dir>/*.[ch]
> 	git format-patch --cover-letter -o patches/<your_branch> staging-next
> 	git send-email patches/<your_branch>

When running this on drivers/base/bus.c, it says that the .o files are
different, when the diffstat for what makes them different is only
whitespace.

I did the following:

$ scripts/reformat_with_checkpatch.sh drivers/base/bus.c

Ignore the first set of things it tries to commit by answering N to the
"Would you like to commit these changes".

Then the second thing it tries to change in the file says that there is
a .o file difference.

Yet the diff is below, I don't see how this happens.  Is this due to
there being some old temp file around because I did not accept the first
set of changes?

thanks,

greg k-h

-------------
diff:

 drivers/base/bus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 83e910a57563..3546d02b46f0 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -32,7 +32,6 @@ static struct kset *system_kset;
 
 #define to_drv_attr(_attr) container_of(_attr, struct driver_attribute, attr)
 
-
 static int __must_check bus_rescan_devices_helper(struct device *dev,
 						void *data);
 
@@ -128,6 +127,7 @@ static const struct sysfs_ops bus_sysfs_ops = {
 int bus_create_file(struct bus_type *bus, struct bus_attribute *attr)
 {
 	int error;
+
 	if (bus_get(bus)) {
 		error = sysfs_create_file(&bus->p->subsys.kobj, &attr->attr);
 		bus_put(bus);
@@ -817,6 +817,7 @@ EXPORT_SYMBOL_GPL(device_reprobe);
 struct bus_type *find_bus(char *name)
 {
 	struct kobject *k = kset_find_obj(bus_kset, name);
+
 	return k ? to_bus(k) : NULL;
 }
 #endif  /*  0  */

--------------


What the script complained about:

Comparing objects...
--- drivers/base/bus.o.new	2014-07-12 01:16:32.984755945 -0700
+++ drivers/base/bus.o.old	2014-07-12 01:16:31.924755967 -0700
@@ -2449,13 +2449,13 @@
 
 0000000000000000 <descriptor.17493>:
 	...
-:	bf 03 00 00 00       	mov    $0x3,%edi
+:	be 03 00 00 00       	mov    $0x3,%esi
 :	00 00                	add    %al,(%rax)
 	...
 
 0000000000000028 <descriptor.17483>:
 	...
-:	a2 03 00 00 00 00 00 	movabs %al,0x3
+:	a1 03 00 00 00 00 00 	movabs 0x3,%eax
 :	00 00 
 
 0000000000000050 <descriptor.17406>:
@@ -2468,7 +2468,7 @@
 
 0000000000000078 <descriptor.17073>:
 	...
-:	56                   	push   %rsi
+:	57                   	push   %rdi
 :	00 00                	add    %al,(%rax)
 :	00 00                	add    %al,(%rax)
 :	00 00                	add    %al,(%rax)
Object differences exist! - Verify changes before commit!

  parent reply	other threads:[~2014-07-12  8:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-12  1:21 [PATCH] reformat_with_checkpatch: Add automation to checkpatch Joe Perches
2014-07-12  1:34 ` Greg KH
2014-07-12  1:40   ` Joe Perches
2014-07-12  2:34     ` Greg KH
2014-07-12  9:30     ` Dan Carpenter
2014-07-12 17:55       ` Greg KH
2014-07-12 18:29         ` Joe Perches
2014-07-12 19:28           ` Greg KH
2014-07-13  3:06             ` Joe Perches
2014-07-12  1:39 ` Greg KH
2014-07-12  1:46   ` Joe Perches
2014-07-12  2:01     ` Greg KH
2014-07-12  2:05       ` Greg KH
2014-07-12  2:09         ` [PATCH] checkpatch: Remove unnecessary + after {8,8} Joe Perches
2014-07-12  2:23           ` Greg KH
2014-08-31 20:58           ` Sören Brinkmann
2014-09-01 16:55         ` [PATCH - resend] " Joe Perches
2014-10-30 11:12           ` Borislav Petkov
2014-10-30 11:15             ` Borislav Petkov
2014-07-12  1:43 ` [PATCH] reformat_with_checkpatch: Add automation to checkpatch Greg KH
2014-07-12  1:50   ` Joe Perches
2014-07-12  1:53 ` Greg KH
2014-07-12  1:57   ` Joe Perches
2014-07-12  2:15     ` Greg KH
2014-07-12  8:08     ` Greg KH
2014-07-12  8:18 ` Greg KH [this message]
2014-07-12 10:13   ` Joe Perches

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=20140712081837.GA28704@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=kernelnewbies@lists.kernelnewbies.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).