All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Alex Dubov <oakad@yahoo.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] memstick: add support for legacy memorysticks
Date: Tue, 25 Sep 2012 12:38:26 -0700	[thread overview]
Message-ID: <20120925193826.GJ16296@google.com> (raw)
In-Reply-To: <1348601173.12068.11.camel@maxim-laptop>

Hello, Maxim.

On Tue, Sep 25, 2012 at 09:26:13PM +0200, Maxim Levitsky wrote:
> > Probably not the best idea to use a name this generic in driver code.
> > linux/scatterlist.h likely might wanna use the name.
>
> Lets not go this route again. I already once submitted these, and had
> a share of problems with merging these poor functions into the scatter
> list.
> scatter list users mostly dont need these as they just translate it into
> hardware specific representation.
> In my case, I don't and yet its easier that working with BIOs. 

Hmmm... then please at least add a prefix to the names.

> > Also, from what it does, it seems sg_copy() is a bit of misnomer.
> > Rename it to sg_remap_with_offset() or something and move it to
> > lib/scatterlist.c?
>
> Don't think so. This copies part of a scatter list into another
> scatterlist.
> I have to use is as memstick underlying drivers expect a single
> scatterlist for each 512 bytes sector I read. Yes, it contains just one
> entry, but still. I haven't designed the interface. 

It doesn't really matter if it's a function only used in the driver,
but please don't use sg_copy() as its name.

> > Maybe we can make sg_copy_buffer() more generic so that it takes a
> > callback and implement this on top of it?  Having sglist manipulation
> > scattered isn't too attractive.
>
> Again this is very specific to my driver. Usually nobody pokes the
> scatterlists. 

The problem is that there are talks of improving sglist handling (make
it more generic, unify it with bvec and so on) and this sort of one
off direct manipulations often become headaches afterwards, so if at
all possible it's best to keep stuff centralized.

> > Is it really necessary to implement explicit state machine?  Can't you
> > just throw a work item at it and process it synchronously?  Explicit
> > state machines can save some resources at the cost of a lot more
> > complexity and generally making things a lot more fragile.  Is it
> > really worth it here?
>
> It would be awesome to not use these ugly state machines, but I have to,
> because this is required by underlying driver interface.
> Its callback driven, that is underlying driver calls into this driver,
> when it wants, and I supply it new command to execute.
> Unfortunately with legacy memsticks, to read or write a sector, one
> needs to send it many different commands. Thats why these state
> machines. I at least made them more or less consistent.
> Just take a look at mspro_blk.c....

I see.  Eeeek...

Thanks.

-- 
tejun

  reply	other threads:[~2012-09-25 19:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-25  8:38 [PATCH v2 memstick: support for legacy sony memsticks Maxim Levitsky
2012-09-25  8:38 ` [PATCH 1/2] scatterlist: add sg_nents Maxim Levitsky
2012-09-25  8:38 ` [PATCH 2/2] memstick: add support for legacy memorysticks Maxim Levitsky
2012-09-25 18:25   ` Tejun Heo
2012-09-25 19:26     ` Maxim Levitsky
2012-09-25 19:38       ` Tejun Heo [this message]
2012-09-25 20:24         ` Maxim Levitsky
2012-09-25 18:02 ` [PATCH v2 memstick: support for legacy sony memsticks Tejun Heo
2012-09-25 19:34   ` Maxim Levitsky
2012-09-25 19:40     ` Tejun Heo
2012-09-25 20:13       ` Maxim Levitsky
  -- strict thread matches above, loose matches on Subject: below --
2012-09-26  9:48 [PATCH v3 " Maxim Levitsky
2012-09-26  9:49 ` [PATCH 2/2] memstick: add support for legacy memorysticks Maxim Levitsky
2012-09-26 16:41   ` Tejun Heo
2012-09-29 17:20   ` Geert Uytterhoeven
2012-10-01 20:24     ` Maxim Levitsky

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=20120925193826.GJ16296@google.com \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maximlevitsky@gmail.com \
    --cc=oakad@yahoo.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.