From: Joe Perches <joe@perches.com>
To: hnnnet48@gmail.com
Cc: gregkh@suse.de, devel@linuxdriverproject.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] This is my first commit
Date: Tue, 27 May 2014 00:03:55 -0700 [thread overview]
Message-ID: <1401174235.18413.8.camel@joe-AO725> (raw)
In-Reply-To: <1401173061-6500-1-git-send-email-hnnnet48@gmail.com>
On Tue, 2014-05-27 at 14:44 +0800, hnnnet48@gmail.com wrote:
> From: kevin <hnnnet48@gmail.com>
Hi Kevin.
You subject line should be something like:
[PATCH] Add support for GeneralTouch serial screen
There should be a commit message too.
> ---
> gtserio.c | 188 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
In what directory should this file be placed?
Will you submit a Makefile/Kconfig mechanism to make it?
You should run your patch through scripts/checkpatch.pl
It will flag a number of things you should consider fixing.
> create mode 100755 gtserio.c
755 is not correct. 644 please.
> diff --git a/gtserio.c b/gtserio.c
[]
> + * gtserio.c - Create an input/output character device for GeneralTouch serial screen
[]
> +MODULE_AUTHOR("GeneralTouch <support@generaltouch.com>");
Kevin, do you work for generaltouch
or did you get this file from somewhere?
> +static int Device_Open = 0;
> +struct input_dev *devq;
> +char Message[BUF_LEN];
> +dev_t gts_t;
> +unsigned char val[10];
> +int gtsdata[4];
> +unsigned long min_x = 0;
> +unsigned long max_x = 32767;
> +unsigned long min_y = 0;
> +unsigned long max_y = 32767;
All of these should probably be static.
> +char *Message_Ptr;
CamelCase is not generally used in linux-kernel.
> +static int device_open(struct inode *inode, struct file *file)
> +{
> + printk("GTS device_open(%p)\n", file);
printk should use a KERN_<LEVEL>
> +
> +#ifdef DEBUG
> + printk("device_open(%p)\n", file);
> +#endif
Unnecessary duplication, this DEBUG should be removed.
> +static int device_release(struct inode *inode, struct file *file)
> +{
> +#ifdef DEBUG
> + printk("device_release(%p,%p)\n", inode, file);
> +#endif
pr_debug is used instead of
#ifdef DEBUG
printk(foo...)
#endif
> + return SUCCESS;
return 0;
instead of a somewhat unnecessary #define
> + printk("val[3] = %x,val[4] = %x\nval[5] = %x,val[6] = %x\n", val[3],
> + val[4], val[5], val[6]);
I suspect this should be pr_debug too.
> + gtsdata[0] = val[2];
> + gtsdata[1] = (val[4] << 8) | (val[3]);
> + gtsdata[2] = (val[6] << 8) | (val[5]);
> + gtsdata[3] = val[9];
> + printk("gtsdata[1] = %x\ngtsdata[2] = %x\n", gtsdata[1], gtsdata[2]);
and this
next prev parent reply other threads:[~2014-05-27 7:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-27 6:44 hnnnet48
2014-05-27 7:03 ` Joe Perches [this message]
2014-05-27 7:11 ` H. Peter Anvin
-- strict thread matches above, loose matches on Subject: below --
2014-05-27 5:31 hnnnet48
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=1401174235.18413.8.camel@joe-AO725 \
--to=joe@perches.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@suse.de \
--cc=hnnnet48@gmail.com \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®