From: Ondrej Zary <linux@zary.sk>
To: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Cc: Christoph Hellwig <hch@lst.de>,
Sergey Shtylyov <s.shtylyov@omp.ru>, Jens Axboe <axboe@kernel.dk>,
Tim Waugh <tim@cyberelk.net>,
linux-block@vger.kernel.org, linux-parport@lists.infradead.org,
linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] pata_parport: add driver (PARIDE replacement)
Date: Mon, 23 Jan 2023 20:13:48 +0100 [thread overview]
Message-ID: <202301232013.48779.linux@zary.sk> (raw)
In-Reply-To: <425b5646-23e2-e271-5ca6-0f3783d39a3b@opensource.wdc.com>
On Monday 23 January 2023 02:03:16 Damien Le Moal wrote:
[...]
> You are missing:
>
> #ifndef LINUX_PATA_PARPORT_H
> #define LINUX_PATA_PARPORT_H
>
> > +#include <linux/libata.h>
> > +
> > +#define PI_PCD 1 /* dummy for paride protocol modules */
> > +
> > +struct pi_adapter {
> > + struct device dev;
> > + struct pi_protocol *proto; /* adapter protocol */
> > + int port; /* base address of parallel port */
> > + int mode; /* transfer mode in use */
> > + int delay; /* adapter delay setting */
> > + int devtype; /* dummy for paride protocol modules */
> > + char *device; /* dummy for paride protocol modules */
> > + int unit; /* unit number for chained adapters */
> > + int saved_r0; /* saved port state */
> > + int saved_r2; /* saved port state */
> > + unsigned long private; /* for protocol module */
> > + struct pardevice *pardev; /* pointer to pardevice */
> > +};
> > +
> > +typedef struct pi_adapter PIA; /* for paride protocol modules */
> > +
> > +/* registers are addressed as (cont,regr)
> > + * cont: 0 for command register file, 1 for control register(s)
> > + * regr: 0-7 for register number.
> > + */
> > +
> > +/* macros and functions exported to the protocol modules */
> > +#define delay_p (pi->delay ? udelay(pi->delay) : (void)0)
> > +#define out_p(offs, byte) do { outb(byte, pi->port + offs); delay_p; } while (0)
> > +#define in_p(offs) (delay_p, inb(pi->port + offs))
>
> It would be way nicer to have these as inline functions.
This should go away (as well as the code below) so I'm not touching it now.
> > +
> > +#define w0(byte) out_p(0, byte)
> > +#define r0() in_p(0)
> > +#define w1(byte) out_p(1, byte)
> > +#define r1() in_p(1)
> > +#define w2(byte) out_p(2, byte)
> > +#define r2() in_p(2)
> > +#define w3(byte) out_p(3, byte)
> > +#define w4(byte) out_p(4, byte)
> > +#define r4() in_p(4)
> > +#define w4w(data) do { outw(data, pi->port + 4); delay_p; } while (0)
> > +#define w4l(data) do { outl(data, pi->port + 4); delay_p; } while (0)
> > +#define r4w() (delay_p, inw(pi->port + 4))
> > +#define r4l() (delay_p, inl(pi->port + 4))
> > +
> > +static inline u16 pi_swab16(char *b, int k)
> > +{
> > + union { u16 u; char t[2]; } r;
> > +
> > + r.t[0] = b[2 * k + 1]; r.t[1] = b[2 * k];
> > + return r.u;
> > +}
> > +
> > +static inline u32 pi_swab32(char *b, int k)
> > +{
> > + union { u32 u; char f[4]; } r;
> > +
> > + r.f[0] = b[4 * k + 1]; r.f[1] = b[4 * k];
> > + r.f[2] = b[4 * k + 3]; r.f[3] = b[4 * k + 2];
> > + return r.u;
> > +}
--
Ondrej Zary
next prev parent reply other threads:[~2023-01-23 19:13 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-21 22:53 [PATCH v2] pata_parport: add driver (PARIDE replacement) Ondrej Zary
2023-01-22 7:57 ` Christoph Hellwig
2023-01-22 18:14 ` [PATCH] paride: Mark PARIDE as deprecated, point to PATA_PARPORT Ondrej Zary
2023-01-22 19:11 ` Sergey Shtylyov
2023-01-22 20:10 ` [PATCH v2] " Ondrej Zary
2023-01-23 7:38 ` [PATCH] " Hannes Reinecke
2023-01-22 18:24 ` [PATCH v2] pata_parport: add driver (PARIDE replacement) Jens Axboe
2023-01-23 1:15 ` Damien Le Moal
2023-01-23 6:52 ` Christoph Hellwig
2023-01-23 14:05 ` Jens Axboe
2023-01-23 7:37 ` Hannes Reinecke
2023-01-23 1:03 ` Damien Le Moal
2023-01-23 19:09 ` [PATCH v3] " Ondrej Zary
2023-01-30 3:30 ` Damien Le Moal
2023-01-30 3:44 ` Jens Axboe
2023-01-30 6:48 ` Christoph Hellwig
2023-01-30 7:10 ` Damien Le Moal
2023-01-30 15:25 ` Jens Axboe
2023-01-30 23:18 ` Damien Le Moal
2023-01-30 15:24 ` Jens Axboe
2023-01-30 21:10 ` [PATCH 1/2] drivers/block: Remove PARIDE core and high-level protocols Ondrej Zary
2023-01-30 21:10 ` [PATCH 2/2] drivers/block: Move PARIDE protocol modules to drivers/ata/pata_parport Ondrej Zary
2023-01-30 23:24 ` Jens Axboe
2023-01-31 2:05 ` Damien Le Moal
2023-01-31 10:24 ` Ondrej Zary
2023-01-31 11:36 ` Damien Le Moal
2023-01-30 23:24 ` [PATCH 1/2] drivers/block: Remove PARIDE core and high-level protocols Jens Axboe
2023-01-23 19:13 ` Ondrej Zary [this message]
2023-01-24 10:02 ` [PATCH v2] pata_parport: add driver (PARIDE replacement) Hannes Reinecke
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=202301232013.48779.linux@zary.sk \
--to=linux@zary.sk \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@opensource.wdc.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parport@lists.infradead.org \
--cc=s.shtylyov@omp.ru \
--cc=tim@cyberelk.net \
/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