From: Matthieu CASTET <matthieu.castet-ITF29qwbsa/QT0dZR+AlfA@public.gmane.org>
To: yuhang wang <wangyuhang2014-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
<broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
<linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
"pekon-l0cyMroinI0@public.gmane.org"
<pekon-l0cyMroinI0@public.gmane.org>,
"spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org"
<spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
"sourav.poddar-l0cyMroinI0@public.gmane.org"
<sourav.poddar-l0cyMroinI0@public.gmane.org>,
"tpiepho-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
<tpiepho-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH] SPI: DUAL and QUAD support
Date: Mon, 29 Jul 2013 17:35:11 +0200 [thread overview]
Message-ID: <20130729173511.65caa07d@parrot.com> (raw)
In-Reply-To: <CAHSAbzOPfpbPHohG7-EzftiPr5T2m19qgrKg7KS2jSKD-B=goA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Le Mon, 29 Jul 2013 15:25:51 +0100,
yuhang wang <wangyuhang2014-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> a écrit :
> Hi,
>
> 2013/7/29 Matthieu CASTET <matthieu.castet-ITF29qwbsa/QT0dZR+AlfA@public.gmane.org>:
> > Le Mon, 29 Jul 2013 11:53:14 +0100,
> > wangyuhang <wangyuhang2014-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> a écrit :
> >
> >> Hi,
> >>
> >> modify two things.
> >> 1:
> >> >> @@ -1316,6 +1324,12 @@ int spi_setup(struct spi_device *spi)
> >> >> /* help drivers fail *cleanly* when they need options
> >> >> * that aren't supported with their current master
> >> >> */
> >> >> + if (((spi->mode >> 8) & 0x03) == 0x03 ||
> >> >> + ((spi->mode >> 10) & 0x03) == 0x03) {
> >> >> + dev_err(&spi->dev,
> >> >> + "setup: can not select dual and quad at the same
> >> >> time\n")
> >> >> + return -EINVAL;
> >> >> + }
> >> >> + return -EINVAL;
> >> >> + }
> >>
> >> >This code won't work if the constants you added for mode flags
> >> >change value. More importantly, anyone searching the code for
> >> >SPI_TX_DUAL, etc. won't find this code.
> >>
> >> so use the certain macro to replace.
> >>
> >> 2:
> >> >You need to make sure that existing userspace binaries can run
> >> >unmodified, changing the types will change the layout of the ioctl
> >> >arguments. This may mean that you need to add new ioctls if you
> >> >need to change types.
> >>
> >> I recovered the SPI_IOC_RD_LSB_FIRST ioctl.
> >> Add new ioctl to fit u16 mode.
> >> In addition,may SPI_IOC_RD_LSB_FIRST should be del in a better way.
> >>
> >> Signed-off-by: wangyuhang <wangyuhang2014-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> >> ---
> >
> >> /* IOCTL commands */
> >> @@ -54,6 +61,8 @@
> >> * @tx_buf: Holds pointer to userspace buffer with transmit data,
> >> or null.
> >> * If no data is provided, zeroes are shifted out.
> >> * @rx_buf: Holds pointer to userspace buffer for receive data, or
> >> null.
> >> + * @tx_nbits: number of bits used for writting.
> >> + * @rx_nbits: number of bits used for reading.
> >> * @len: Length of tx and rx buffers, in bytes.
> >> * @speed_hz: Temporary override of the device's bitrate.
> >> * @bits_per_word: Temporary override of the device's wordsize.
> >> @@ -85,6 +94,8 @@
> >> struct spi_ioc_transfer {
> >> __u64 tx_buf;
> >> __u64 rx_buf;
> >> + __u8 tx_nbits;
> >> + __u8 rx_nbits;
> >>
> >> __u32 len;
> >> __u32 speed_hz;
> > You still break old userspace ABI.
> >
> > You need to create a new structure, if you need to add fields.
> >
> I dont think adding the members will cause the program in userspace
> any errors. User do not have to set these members.
Did you try to run on your patch kernel a program build without the
patch ?
if I build my program with :
> >> struct spi_ioc_transfer {
> >> __u64 tx_buf;
> >> __u64 rx_buf;
> >>
> >> __u32 len;
> >> __u32 speed_hz;
Now I run it on a new kernel.
The kernel won't parse correctly my structure : len will go in
tx_nbits, rx_nbits and len.
Keep in mind that it is binary interface, not source interface. You
should not have to rebuild your binary.
Matthieu
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
next prev parent reply other threads:[~2013-07-29 15:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-27 9:39 [PATCH V2] SPI: DUAL and QUAD support wangyuhang
[not found] ` <1374917973-7083-1-git-send-email-wangyuhang2014-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-07-29 0:32 ` Trent Piepho
[not found] ` <CA+7tXihU+JODQec-h2joUYiVY=otuSOu8BwADn+mtgELCFHPng-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-29 2:44 ` yuhang wang
2013-07-29 6:42 ` Mark Brown
[not found] ` <20130729064234.GS9858-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-07-29 10:53 ` [PATCH] " wangyuhang
2013-07-29 12:43 ` Gupta, Pekon
[not found] ` <20980858CB6D3A4BAE95CA194937D5E73E9EE267-yXqyApvAXouIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2013-07-29 13:58 ` yuhang wang
2013-07-29 14:21 ` Gupta, Pekon
[not found] ` <20980858CB6D3A4BAE95CA194937D5E73E9EE356-yXqyApvAXouIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2013-07-29 14:52 ` yuhang wang
2013-07-29 23:26 ` Trent Piepho
[not found] ` <CA+7tXijduVqFdao3L3oJcFBYw_cffdyo-fwyAS2cBASfEMExpA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-30 7:30 ` yuhang wang
2013-08-08 8:57 ` Gupta, Pekon
[not found] ` <20980858CB6D3A4BAE95CA194937D5E73E9F1E1B-yXqyApvAXouIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2013-08-09 3:22 ` yuhang wang
2013-08-09 4:25 ` Gupta, Pekon
[not found] ` <20980858CB6D3A4BAE95CA194937D5E73E9F22F0-yXqyApvAXouIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2013-08-09 9:14 ` yuhang wang
2013-08-07 11:57 ` Gupta, Pekon
[not found] ` <20980858CB6D3A4BAE95CA194937D5E73E9F1993-yXqyApvAXouIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2013-08-09 2:09 ` yuhang wang
2013-08-09 2:50 ` Gupta, Pekon
[not found] ` <1375095194-7093-1-git-send-email-wangyuhang2014-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-07-29 12:56 ` Matthieu CASTET
[not found] ` <20130729145626.6c227aa0-ITF29qwbsa/QT0dZR+AlfA@public.gmane.org>
2013-07-29 14:25 ` yuhang wang
[not found] ` <CAHSAbzOPfpbPHohG7-EzftiPr5T2m19qgrKg7KS2jSKD-B=goA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-29 15:35 ` Matthieu CASTET [this message]
[not found] ` <20130729173511.65caa07d-ITF29qwbsa/QT0dZR+AlfA@public.gmane.org>
2013-07-30 1:13 ` yuhang wang
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=20130729173511.65caa07d@parrot.com \
--to=matthieu.castet-itf29qwbsa/qt0dzr+alfa@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=pekon-l0cyMroinI0@public.gmane.org \
--cc=sourav.poddar-l0cyMroinI0@public.gmane.org \
--cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=tpiepho-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=wangyuhang2014-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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).