lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 24 Dec 2012 11:16:52 -0500
From:	Jun Chen <jun.d.chen@...el.com>
To:	Grant Likely <grant.likely@...retlab.ca>
Cc:	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	linux-kernel@...r.kernel.org, Bi Chao <chao.bi@...el.com>,
	spi-devel-general@...ts.sourceforge.net, jun.zhang@...el.com
Subject: Re: [PATCH] spi: Add the flag indicate to registe new device as
 children of master or not.

On Fri, 2012-12-21 at 19:06 +0000, Grant Likely wrote:
> On Fri, 21 Dec 2012 12:39:52 -0500, Jun Chen <jun.d.chen@...el.com> wrote:
> > On Wed, 2012-12-19 at 16:21 +0000, Grant Likely wrote:
> > > On Wed, 19 Dec 2012 09:04:16 +0000, Mark Brown <broonie@...nsource.wolfsonmicro.com> wrote:
> > > > On Wed, Dec 19, 2012 at 04:44:03AM -0500, Jun Chen wrote:
> > > > 
> > > > > This spi_alloc_device function will be called in the spi_new_device
> > > > > function to alloc new device as the master. But other way, it is called
> > > > > by the of_register_spi_devices function to register new device as the
> > > > > children of the master. I will update changlog to add it. 
> > > > 
> > > > But why is this a bad thing?  You've said what's happening but not why
> > > > it's a problem.
> > > 
> > > spi_devices should always be children of the spi_master. If that is not
> > > the case then it is a bug to be fixed.
> > > 
> > 
> > When many boards initializing, boards will call function
> > spi_register_board_info to create bi->board_info,Then spi driver probe
> > to call spi_register_master to register the driver and in the function
> > spi_match_master_to_boardinfo To create new spi device, and this cases
> > the spi_devices are not children of the spi_master.
> > Many drivers do these steps. If all spi_devices must be children of the
> > spi_master, Do spi core have plan to delete this way? 
> > Or spi core can hold this way for many drivers. 
> 
> Let me make sure I understand what you're saying...
> 
> Right now, every spi_device object is registered as a child of an
> spi_master object.
> 
> With this proposed patch, spi_devices registered via spi_register_board_info
> will be siblings of the spi_master instead of children.
> 
> Do I understand correctly so far?
> 
Yes, 

> The problem is that I don't understand why this change is necessary.
> spi_devices should always be children of an spi_master, not siblings.
> What is the problem you're trying to solve with this change?
> 
When spi drivers try to use the core function(spi_register_master),it
will trigger error,because they use the function
spi_match_master_to_boardinfo  to create new spi device as the children
of the master.
In the old version of spi core, the new devices are registered as
siblings of the spi_master. My spi driver based on the old version runs
normal.

But after applying for this patch:
{
    spi: Fix device unregistration when unregistering the bus master
    
    Device are added as children of the bus master's parent device, but
    spi_unregister_master() looks for devices to unregister in the bus
    master's children. This results in the child devices not being
    unregistered.
    
    Fix this by registering devices as direct children of the bus
master.


-	spi->dev.parent = dev;
+	spi->dev.parent = &master->dev;
}

Then my driver will be crash.
Maybe I have mistake on this issue, thank for your more explanation and
detail replay. 

> g.
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ