Linux ATA/IDE development
 help / color / mirror / Atom feed
* Bitte kontaktieren Sie mich für weitere Details!
From: Miss Marbell @ 2017-02-01  8:14 UTC (permalink / raw)


Sehr geehrte Damen und Herren,

Ich brauche Ihre Unterstützung in Ihrem Land zu verlagern und zu investieren.Ich bitte Sie um Hilfe, weil ich nicht das Wissen über
Geschäft und die Regeln, die Ihr Land für eine sichere Investition führen.

Werden Sie versprechen, mit mir aufrichtig zu sein?

Bitte kontaktieren Sie mich für weitere Details!

Mit freundlichen Grüßen,
Fräulein Marbell.

^ permalink raw reply

* Re: [PATCH 0/3] ata: add m68k/Atari Falcon PATA support
From: Finn Thain @ 2017-02-01  8:40 UTC (permalink / raw)
  To: Michael Schmitz
  Cc: Bartlomiej Zolnierkiewicz, Tejun Heo, Geert Uytterhoeven,
	linux-ide, Linux/m68k, Linux Kernel Development, Andreas Schwab
In-Reply-To: <a524b8e2-b7ea-482d-f62c-b0460e852a8b@gmail.com>


On Fri, 27 Jan 2017, Michael Schmitz wrote:

> Am 26.01.2017 um 21:47 schrieb Finn Thain:
> 
> > This would imply CPU overhead that is half of that which mac_scsi 
> > incurs. That's the best case, but I see no reason to expect worse 
> > performance than PDMA gets.
> 
> But how much more overhead would we have compared to using the SCSI 
> interrupt to signal DMA completion?
> 

I imagine that contention for the CPU bus would be a problem if we polled 
the interrupt flag without any delay between iterations. With a small 
delay I think the overhead would be comparable with PDMA and therefore 
tolerable.

> The libata driver currently does disable the IDE interrupt and uses 
> polling, but I'd like to change that if at all possible. Sorry I didn't 
> make that clear.
> 

[snip]

> Since IDE does not use the ST-DMA and does not share any registers with 
> ST-DMA, peeking at the IDE status register in order to decide whether 
> the interrupt was raised by the IDE interface won't hurt the running DMA 
> process (regardless of whether FDC or SCSI started it). Nor will 
> servicing the IDE interrupt.
> 

Maybe we can just call the IDE handler from the ST-DMA handler regardless 
of the status register. For a shared interrupt handler this should work 
okay. (BTW, where is the IDE status register found anyway?)

> If at the end of the IDE interrupt processing the interrupt status is 
> cleared in the IDE interface, the interrupt line should go high again 
> before the IDE inthandler returns.
> 

On page 2 of the schematic, MFP pin I5 is wired to the output of the 
logical OR combination of the IDEIRQ and XDISKINT signals (actually 
active-low signals fed into an AND gate). The pin is edge-triggered.

This is just like the wired-OR Nubus slot IRQs connected to the Mac's VIA 
pin. The handler must ack all asserted IRQs. Otherwise there will be no 
more edges and no more interrupts.

This means looping over the IDE, FDC/SCSI DMA handlers until they all 
return IRQ_NONE. (Or equivalently, looping over the IRQ flags in the 
device registers until they are all de-asserted.)

BTW, this makes me think that the stdma.c mechanism is already flawed, 
since stdma_int() can cause only one of IDEIRQ and XDISKINT to become 
inactive, but not both. That's fine as long as no device raises IRQ until 
it's driver acquires the stdma lock -- but we know this is not true for 
the 5380 bus reset interrupt and it isn't true for IDE devices either 
(based on Geert's email in this thread).

> If we can ensure that the FDC/SCSI interrupt handler runs after the IDE 
> handler, we can then make that handler check the interrupt line status 
> and bail out if there's nothing to be done. (For the sake of simplicity, 
> this check can be done in stdma_int() since we need to retain mutual 
> locking of the DMA interface by SCSI and FDC anyway.)
> 
> We can ensure the IDE interrupt is called first by using a special 
> interrupt controller to register separate IDE and FDC/SCSI interrupts 
> with (I've done that to provide distinct interrupt numbers and handlers 
> for the timer D interrupt that's used to poll ethernet and USB interface 
> status on the ROM port).
> 
> That way, we can ensure IDE interrupts do not step on the ST-DMA state, 
> and all that remains are premature SCSI interrupts terminating DMA 
> transfer (which we already face anyway).
> 
> Am I missing a potential race here? Does IDE send the next request off 
> to the disk from inside the interrupt handler so we could see IDE 
> immediately raise the next interrupt?  In that case, we'd also need to 
> check the IDE interrupt status in the interface status register, and 
> bail out for another pass through the IDE/FDC/SCSI handlers until IDE is 
> no longer posting an interrupt...
> 

I don't know anything about IDE so I can't comment on this particular 
scenario (IDE interrupt handler causing IDE interrupt). The race condition 
may be only theoretical.

What you seem to be aiming at is an algorithm to ensure that no DMA 
interrupt is handled whilst an IDE interrupt is pending. Taking into 
account the logical OR issue, one could imagine a handler for the 
IRQ_MFP_FSCSI interrupt something like the following. (This code is 
probably useless for implementing your interrupt controller, but I hope it 
illustrates some of the issues.)

	do {
		handled = ata_handler(irq, ata_dev);
		if (handled == IRQ_NONE && atari_irq_pending(IRQ_MFP_FSCSI))
			handled |= stdma_int(irq, stdma_dev);
	} while (handled != IRQ_NONE);

Clearly this is not free from race conditions. The other problem is the 
use of atari_irq_pending(IRQ_MFP_FSCSI). It tells us when an edge appears 
but doesn't tell us about the present state of the IRQ output pins on the 
NCR5380 or the WD1772. We can't access the device registers so 
st_mfp.par_dt_reg & BIT(5) must be used instead of 
atari_irq_pending(IRQ_MFP_FSCSI);

The simplest approach is to treat it like a shared interrupt, with a loop 
to account for the logical OR:

	do {
		handled = ata_handler(irq, ata_dev) | 
		          scsi_falcon_intr(irq, scsi_dev) |
		          fdc_handler(irq, fdc_dev);
	} while (handled != IRQ_NONE);

This should work fine with polled DMA (and might even allow the flawed 
stdma.c lock mechanism to be eliminated) but it can't work with your 
scheme because scsi_falcon_intr() assumes exclusive access to the IRQ; 
hence it must not be called unless there is an actual 5380 or DMA 
interrupt.

I don't know which scheme is better. Mine is simpler and probably free of 
race conditions but does burn some CPU time. Your scheme is more 
complicated.

-- 

> Cheers,
> 
> 	Michael
> 

^ permalink raw reply

* Re: [PATCH 0/3] ata: add m68k/Atari Falcon PATA support
From: Geert Uytterhoeven @ 2017-02-01  8:45 UTC (permalink / raw)
  To: Finn Thain
  Cc: Michael Schmitz, Bartlomiej Zolnierkiewicz, Tejun Heo,
	linux-ide@vger.kernel.org, Linux/m68k, Linux Kernel Development,
	Andreas Schwab
In-Reply-To: <alpine.LNX.2.00.1701271858100.368@nippy.intranet>

Hi Finn,

On Wed, Feb 1, 2017 at 9:40 AM, Finn Thain <fthain@telegraphics.com.au> wrote:
> okay. (BTW, where is the IDE status register found anyway?)

In the IDE device.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply

* Re: remove the cmd_type field from struct request
From: Bartlomiej Zolnierkiewicz @ 2017-02-01 10:37 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Christoph Hellwig, linux-block, linux-scsi, linux-ide,
	linux-kernel
In-Reply-To: <bbe16fc1-5652-bbc2-03a5-0298c3f16645@kernel.dk>


Hi,

On Tuesday, January 31, 2017 10:02:50 AM Jens Axboe wrote:
> On 01/31/2017 07:57 AM, Christoph Hellwig wrote:
> > [1] which were a pain in the ass to untangle and debug during development,
> > it's really time for it to die..
> 
> Outside of the patch series in question, how to we expedite the
> euthanasia of IDE? What explicit features/support are we missing through

When it comes to missing features/support there is still
number of non-x86 host drivers not ported to libata (I'm
slowly working on this as a side-task, any help would be
much appreciated).

> libata that would need to be added, before we can git rm drivers/ide/ ?

I was trying to start the removal with [1] last year but
it has been NAK-ed by DaveM who seems to want to keep
drivers/ide/ forever [2].

[1] https://lkml.org/lkml/2016/2/4/409
[2] https://lkml.org/lkml/2016/12/8/423

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


^ permalink raw reply

* Re: remove the cmd_type field from struct request
From: Sergei Shtylyov @ 2017-02-01 10:55 UTC (permalink / raw)
  To: Hannes Reinecke, Jens Axboe, Christoph Hellwig
  Cc: linux-block, linux-scsi, linux-ide, linux-kernel
In-Reply-To: <c61b9b98-8e4a-ac23-bf0c-002d112d5468@suse.de>

On 2/1/2017 9:53 AM, Hannes Reinecke wrote:

>>> [1] which were a pain in the ass to untangle and debug during development,
>>> it's really time for it to die..
>>
>> Outside of the patch series in question, how to we expedite the
>> euthanasia of IDE? What explicit features/support are we missing through
>> libata that would need to be added, before we can git rm drivers/ide/ ?
>>
> There is only a single driver (sgi_ide) which hasn't been moved over to
> libata.

    Huh? What about Toshiba TC86C001 and TX4938/9, TI DaVinci? That's off the 
top of my head only...

> But this is for an old Itanium-based server only, and even SGI didn't
> press us to have this ported.
> (And we have disabled the IDE drivers since SLES11, where we still support
> Itanium.)

    Or do you mean only the drivers SuSe is interested in?

[...]
> Cheers,
>
> Hannes

MBR, Sergei

^ permalink raw reply

* Re: [PATCH 0/3] ata: add m68k/Atari Falcon PATA support
From: Michael Schmitz @ 2017-02-02  7:48 UTC (permalink / raw)
  To: Finn Thain
  Cc: Bartlomiej Zolnierkiewicz, Tejun Heo, Geert Uytterhoeven,
	linux-ide, Linux/m68k, Linux Kernel Development, Andreas Schwab
In-Reply-To: <alpine.LNX.2.00.1701271858100.368@nippy.intranet>

Hi Finn,


Am 01.02.2017 um 21:40 schrieb Finn Thain:
> 
> On Fri, 27 Jan 2017, Michael Schmitz wrote:
> 
>> Am 26.01.2017 um 21:47 schrieb Finn Thain:
>>
>>> This would imply CPU overhead that is half of that which mac_scsi 
>>> incurs. That's the best case, but I see no reason to expect worse 
>>> performance than PDMA gets.
>>
>> But how much more overhead would we have compared to using the SCSI 
>> interrupt to signal DMA completion?
>>
> 
> I imagine that contention for the CPU bus would be a problem if we polled 
> the interrupt flag without any delay between iterations. With a small 
> delay I think the overhead would be comparable with PDMA and therefore 
> tolerable.

The first delay can even be quite long, estimated based on the transfer
size.

>> Since IDE does not use the ST-DMA and does not share any registers with 
>> ST-DMA, peeking at the IDE status register in order to decide whether 
>> the interrupt was raised by the IDE interface won't hurt the running DMA 
>> process (regardless of whether FDC or SCSI started it). Nor will 
>> servicing the IDE interrupt.
>>
> 
> Maybe we can just call the IDE handler from the ST-DMA handler regardless 
> of the status register. For a shared interrupt handler this should work 
> okay. (BTW, where is the IDE status register found anyway?)

We could do that as well, true. Easier to implement on the quick.

>> If at the end of the IDE interrupt processing the interrupt status is 
>> cleared in the IDE interface, the interrupt line should go high again 
>> before the IDE inthandler returns.
>>
> 
> On page 2 of the schematic, MFP pin I5 is wired to the output of the 
> logical OR combination of the IDEIRQ and XDISKINT signals (actually 
> active-low signals fed into an AND gate). The pin is edge-triggered.
> 
> This is just like the wired-OR Nubus slot IRQs connected to the Mac's VIA 
> pin. The handler must ack all asserted IRQs. Otherwise there will be no 
> more edges and no more interrupts.

Quite right - that's why I mentioned monitoring the IRQ signal status in
the GPIO register.

> This means looping over the IDE, FDC/SCSI DMA handlers until they all 
> return IRQ_NONE. (Or equivalently, looping over the IRQ flags in the 
> device registers until they are all de-asserted.)

Looping over the handlers risks stopping the DMA without need (except
for IDE).

> BTW, this makes me think that the stdma.c mechanism is already flawed, 
> since stdma_int() can cause only one of IDEIRQ and XDISKINT to become 
> inactive, but not both. That's fine as long as no device raises IRQ until 
> it's driver acquires the stdma lock -- but we know this is not true for 
> the 5380 bus reset interrupt and it isn't true for IDE devices either 
> (based on Geert's email in this thread).

The initial bus reset code had safeguards against raising an interrupt -
the IRQ was 'turned off' while the bus reset was executed. Maybe we need
something like that, at least in the case where SCSI does not hold the
ST-DMA lock.

>> If we can ensure that the FDC/SCSI interrupt handler runs after the IDE 
>> handler, we can then make that handler check the interrupt line status 
>> and bail out if there's nothing to be done. (For the sake of simplicity, 
>> this check can be done in stdma_int() since we need to retain mutual 
>> locking of the DMA interface by SCSI and FDC anyway.)
>>
>> We can ensure the IDE interrupt is called first by using a special 
>> interrupt controller to register separate IDE and FDC/SCSI interrupts 
>> with (I've done that to provide distinct interrupt numbers and handlers 
>> for the timer D interrupt that's used to poll ethernet and USB interface 
>> status on the ROM port).
>>
>> That way, we can ensure IDE interrupts do not step on the ST-DMA state, 
>> and all that remains are premature SCSI interrupts terminating DMA 
>> transfer (which we already face anyway).
>>
>> Am I missing a potential race here? Does IDE send the next request off 
>> to the disk from inside the interrupt handler so we could see IDE 
>> immediately raise the next interrupt?  In that case, we'd also need to 
>> check the IDE interrupt status in the interface status register, and 
>> bail out for another pass through the IDE/FDC/SCSI handlers until IDE is 
>> no longer posting an interrupt...
>>
> 
> I don't know anything about IDE so I can't comment on this particular 
> scenario (IDE interrupt handler causing IDE interrupt). The race condition 
> may be only theoretical.
> 
> What you seem to be aiming at is an algorithm to ensure that no DMA 
> interrupt is handled whilst an IDE interrupt is pending. Taking into 

Whilst the IDE interrupt is the only one pending, to be precise.

> account the logical OR issue, one could imagine a handler for the 
> IRQ_MFP_FSCSI interrupt something like the following. (This code is 
> probably useless for implementing your interrupt controller, but I hope it 
> illustrates some of the issues.)
> 
> 	do {
> 		handled = ata_handler(irq, ata_dev);
> 		if (handled == IRQ_NONE && atari_irq_pending(IRQ_MFP_FSCSI))
> 			handled |= stdma_int(irq, stdma_dev);
> 	} while (handled != IRQ_NONE);

Not quite - we can't be certain that there aren't actually two
interrupts pending (say IDE interrupts first, and while we service that
interrupt, SCSI interrupts next but since the IRQ signal remains low, we
don't trigger another interrupt). So we must run the loop for both IDE
and stdma_int for as long as the IRQ signal remains low.

I had missed the case where SCSI interrupts first and the IDE interrupt
only comes in while the SCSI inthandler is running - need to think a bit
more about this.

> Clearly this is not free from race conditions. The other problem is the 
> use of atari_irq_pending(IRQ_MFP_FSCSI). It tells us when an edge appears 
> but doesn't tell us about the present state of the IRQ output pins on the 
> NCR5380 or the WD1772. We can't access the device registers so 
> st_mfp.par_dt_reg & BIT(5) must be used instead of 
> atari_irq_pending(IRQ_MFP_FSCSI);

I've written a function to that effect, and tested it in the current
Falcon inthandler (without sharing the interrupt truly yet).

> The simplest approach is to treat it like a shared interrupt, with a loop 
> to account for the logical OR:
> 
> 	do {
> 		handled = ata_handler(irq, ata_dev) | 
> 		          scsi_falcon_intr(irq, scsi_dev) |
> 		          fdc_handler(irq, fdc_dev);
> 	} while (handled != IRQ_NONE);

We can never have both SCSI and FDC interrupt at the same time (both
register access and DMA setup are shared between the two). Best retain
stdma_lock() for these two.

> This should work fine with polled DMA (and might even allow the flawed 
> stdma.c lock mechanism to be eliminated) but it can't work with your 
> scheme because scsi_falcon_intr() assumes exclusive access to the IRQ; 
> hence it must not be called unless there is an actual 5380 or DMA 
> interrupt.

Correct - polled DMA might be easier to handle here.

> I don't know which scheme is better. Mine is simpler and probably free of 
> race conditions but does burn some CPU time. Your scheme is more 
> complicated.

Meaning likely to race...

I'll have to test this with IDE removed from the locking scheme, and
we'll hopefully see races pretty quick.

Got a few new ideas to try now, thanks!

Cheers,

	Michael

^ permalink raw reply

* Re: [PATCH] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems
From: Gwendal Grignou @ 2017-02-07 20:21 UTC (permalink / raw)
  To: whiteheadm
  Cc: Tejun Heo, One Thousand Gnomes, Greg Kroah-Hartman,
	Sergei Shtylyov, IDE/ATA development list
In-Reply-To: <CAP8WD_b2PXXXQgTQ_-a=8Z7ppNMa5xGuhsEvJGDT_WvT1EFwog@mail.gmail.com>

link2, dev2.x are not leaking. pata_legacy.1 is not freed because of ata2.
I extracted some of the output where the ata port object is not freed properly:

 ref=1++ (attribute_container_add_device:transport_setup_device:ata_tport_add)
 ref=2++ (ata_tport_add:ata_host_register:ata_host_activate)
 ref=3++ (klist_node_init:klist_add_tail:device_add)
 ref=4-- (ata_tport_add:ata_host_register:ata_host_activate)
 ref=3++ (attribute_container_add_class_device:transport_add_class_device:attribute_container_device_trigger)
 ref=4++ (kobject_add:get_device_parent:device_add)
 ref=5++ (ata_tlink_add:ata_tport_add:ata_host_register)
 ref=6++ (ata_tlink_add:ata_tport_add:ata_host_register)
 ref=7++ (kobject_add:device_add:ata_tlink_add)
 ref=8++ (scsi_add_host_with_dma:ata_scsi_add_hosts:ata_host_register)
 ref=9++ (kobject_add:device_add:scsi_add_host_with_dma)
 ref=10++ (scsi_add_host_with_dma:ata_scsi_add_hosts:ata_host_register)


 ref=11-- (device_del:scsi_remove_host:ata_host_detach)
 ref=10-- (scsi_remove_host:ata_host_detach:legacy_init [pata_legacy])
 ref=9-- (device_del:ata_tlink_delete:ata_tport_delete)
 ref=8-- (ata_tlink_delete:ata_tport_delete:ata_host_detach)
 ref=7-- (ata_tlink_release:device_release:kobject_cleanup)
 ref=6-- (kobject_cleanup:kobject_put:cleanup_glue_dir)
 ref=5-- (attribute_container_class_device_del:transport_remove_classdev:attribute_container_device_trigger)
 ref=4-- (klist_put:klist_del:device_del)
 ref=3-- (attribute_container_release:device_release:kobject_cleanup)
 ref=2-- (ata_tport_delete:ata_host_detach:legacy_init [pata_legacy])

Trying to match the put and get, I notice that scsi_add_host_with_dma
does 2 direct get, but scsi_remove_host only one direct put.
I did the following match:

 ref=1++ (attribute_container_add_device:transport_setup_device:ata_tport_add)
       --> ref=3-- (attribute_container_release:device_release:kobject_cleanup)
 ref=3++ (klist_node_init:klist_add_tail:device_add) -->  ref=4--
(klist_put:klist_del:device_del)
 ref=3++ (attribute_container_add_class_device:transport_add_class_device:attribute_container_device_trigger)
       --> ref=5--
(attribute_container_class_device_del:transport_remove_classdev:attribute_container_device_trigger)
 ref=4++ (kobject_add:get_device_parent:device_add) --> ref=6--
(kobject_cleanup:kobject_put:cleanup_glue_dir)
 ref=5++ (ata_tlink_add:ata_tport_add:ata_host_register) --> ref=7--
(ata_tlink_release:device_release:kobject_cleanup)
 ref=6++ (ata_tlink_add:ata_tport_add:ata_host_register)  -->  ref=8--
(ata_tlink_delete:ata_tport_delete:ata_host_detach)
 ref=7++ (kobject_add:device_add:ata_tlink_add)  --> ref=9--
(device_del:ata_tlink_delete:ata_tport_delete)
 ref=8++ (scsi_add_host_with_dma:ata_scsi_add_hosts:ata_host_register)
-->  ref=10-- (scsi_remove_host:ata_host_detach:..
 ref=9++ (kobject_add:device_add:scsi_add_host_with_dma)         -->
ref=11-- (device_del:scsi_remove_host:ata_host_detach)
 ref=10++ (scsi_add_host_with_dma:ata_scsi_add_hosts:ata_host_register)

Then the final call should have trigger destruction the port object:
 ref=2-- (ata_tport_delete:ata_host_detach:legacy_init [pata_legacy])

Looking at scsi_add_host_with_dma/scsi_remove_host, we need to do
get_device on shost->shost_gendev.parent because we will do put_device
in scsi_host_dev_release, the release function of shost_gendev (which
is not called).
We do get_device on shost->shost_gendev for scsi_host_cls_release()
put_device, the release function of shost->host_dev, so I think it is
fine.

I am wondering if we don't have a circular dependency:
We do the final put_device (in scsi_host_put) on ap->scsi_host in
ata_host_release(), but it is not called because
[scsi_host]->shost_gendev.parent is &ap->tdev which hold the put on
its parent, ap.

If my understanding is correct, as Tejun pointed out, removing the put
on ap in ata_tport_release and the get_device(parent) in ata_tport_add
should unlock the situation.

^ permalink raw reply

* Re: [PATCH] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems
From: Tejun Heo @ 2017-02-08 19:43 UTC (permalink / raw)
  To: Gwendal Grignou
  Cc: whiteheadm, One Thousand Gnomes, Greg Kroah-Hartman,
	Sergei Shtylyov, IDE/ATA development list
In-Reply-To: <CAMHSBOUAMxTj7u5Jg4_VkxHmG5BUCr-AhDHY2UT+VMchn8daLQ@mail.gmail.com>

Hello,

On Tue, Feb 07, 2017 at 12:21:37PM -0800, Gwendal Grignou wrote:
> I am wondering if we don't have a circular dependency:
> We do the final put_device (in scsi_host_put) on ap->scsi_host in
> ata_host_release(), but it is not called because
> [scsi_host]->shost_gendev.parent is &ap->tdev which hold the put on
> its parent, ap.
> 
> If my understanding is correct, as Tejun pointed out, removing the put
> on ap in ata_tport_release and the get_device(parent) in ata_tport_add
> should unlock the situation.

Heh, I'm not quite sure I follow but something like the following, right?

Matthew, can you please give this a try?

Thanks.

diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
index 7ef16c0..20e2b7a 100644
--- a/drivers/ata/libata-transport.c
+++ b/drivers/ata/libata-transport.c
@@ -224,7 +224,6 @@ static DECLARE_TRANSPORT_CLASS(ata_port_class,
 
 static void ata_tport_release(struct device *dev)
 {
-	put_device(dev->parent);
 }
 
 /**
@@ -284,7 +283,7 @@ int ata_tport_add(struct device *parent,
 	device_initialize(dev);
 	dev->type = &ata_port_type;
 
-	dev->parent = get_device(parent);
+	dev->parent = parent;
 	dev->release = ata_tport_release;
 	dev_set_name(dev, "ata%d", ap->print_id);
 	transport_setup_device(dev);
@@ -348,7 +347,6 @@ static DECLARE_TRANSPORT_CLASS(ata_link_class,
 
 static void ata_tlink_release(struct device *dev)
 {
-	put_device(dev->parent);
 }
 
 /**
@@ -410,7 +408,7 @@ int ata_tlink_add(struct ata_link *link)
 	int error;
 
 	device_initialize(dev);
-	dev->parent = get_device(&ap->tdev);
+	dev->parent = &ap->tdev;
 	dev->release = ata_tlink_release;
 	if (ata_is_host_link(link))
 		dev_set_name(dev, "link%d", ap->print_id);
@@ -589,7 +587,6 @@ static DECLARE_TRANSPORT_CLASS(ata_dev_class,
 
 static void ata_tdev_release(struct device *dev)
 {
-	put_device(dev->parent);
 }
 
 /**
@@ -662,7 +659,7 @@ static int ata_tdev_add(struct ata_device *ata_dev)
 	int error;
 
 	device_initialize(dev);
-	dev->parent = get_device(&link->tdev);
+	dev->parent = &link->tdev;
 	dev->release = ata_tdev_release;
 	if (ata_is_host_link(link))
 		dev_set_name(dev, "dev%d.%d", ap->print_id,ata_dev->devno);

^ permalink raw reply related

* Help Desk Password
From: Aryahna Levy @ 2017-02-09 21:57 UTC (permalink / raw)
  To: info@mail.org

Faculty, Staff,

This e-mail has been sent to you by Outlook Web App If you do not agree to update your account, your email account will be blocked.

Click Here<http://p-sd2.tripod.com/> to update

Sincerely,
©Faculty/ IT

^ permalink raw reply

* Re: [PATCH] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems
From: Gwendal Grignou @ 2017-02-09 23:49 UTC (permalink / raw)
  To: Tejun Heo
  Cc: whiteheadm, One Thousand Gnomes, Greg Kroah-Hartman,
	Sergei Shtylyov, IDE/ATA development list
In-Reply-To: <20170208194330.GB25826@htj.duckdns.org>

On Wed, Feb 8, 2017 at 11:43 AM, Tejun Heo <tj@kernel.org> wrote:
> Hello,
>
> On Tue, Feb 07, 2017 at 12:21:37PM -0800, Gwendal Grignou wrote:
>> I am wondering if we don't have a circular dependency:
>> We do the final put_device (in scsi_host_put) on ap->scsi_host in
>> ata_host_release(), but it is not called because
>> [scsi_host]->shost_gendev.parent is &ap->tdev which hold the put on
>> its parent, ap.
>>
>> If my understanding is correct, as Tejun pointed out, removing the put
>> on ap in ata_tport_release and the get_device(parent) in ata_tport_add
>> should unlock the situation.
>
> Heh, I'm not quite sure I follow but something like the following, right?
That's correct.
>
> Matthew, can you please give this a try?
>
> Thanks.
>
> diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
> index 7ef16c0..20e2b7a 100644
> --- a/drivers/ata/libata-transport.c
> +++ b/drivers/ata/libata-transport.c
> @@ -224,7 +224,6 @@ static DECLARE_TRANSPORT_CLASS(ata_port_class,
>
>  static void ata_tport_release(struct device *dev)
>  {
> -       put_device(dev->parent);
>  }
>
>  /**
> @@ -284,7 +283,7 @@ int ata_tport_add(struct device *parent,
>         device_initialize(dev);
>         dev->type = &ata_port_type;
>
> -       dev->parent = get_device(parent);
> +       dev->parent = parent;
>         dev->release = ata_tport_release;
>         dev_set_name(dev, "ata%d", ap->print_id);
>         transport_setup_device(dev);
> @@ -348,7 +347,6 @@ static DECLARE_TRANSPORT_CLASS(ata_link_class,
>
>  static void ata_tlink_release(struct device *dev)
>  {
> -       put_device(dev->parent);
>  }
>
>  /**
> @@ -410,7 +408,7 @@ int ata_tlink_add(struct ata_link *link)
>         int error;
>
>         device_initialize(dev);
> -       dev->parent = get_device(&ap->tdev);
> +       dev->parent = &ap->tdev;
>         dev->release = ata_tlink_release;
>         if (ata_is_host_link(link))
>                 dev_set_name(dev, "link%d", ap->print_id);
> @@ -589,7 +587,6 @@ static DECLARE_TRANSPORT_CLASS(ata_dev_class,
>
>  static void ata_tdev_release(struct device *dev)
>  {
> -       put_device(dev->parent);
>  }
>
>  /**
> @@ -662,7 +659,7 @@ static int ata_tdev_add(struct ata_device *ata_dev)
>         int error;
>
>         device_initialize(dev);
> -       dev->parent = get_device(&link->tdev);
> +       dev->parent = &link->tdev;
>         dev->release = ata_tdev_release;
>         if (ata_is_host_link(link))
>                 dev_set_name(dev, "dev%d.%d", ap->print_id,ata_dev->devno);

^ permalink raw reply

* Re: [PATCH] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems
From: tedheadster @ 2017-02-10  0:36 UTC (permalink / raw)
  To: Gwendal Grignou
  Cc: Tejun Heo, One Thousand Gnomes, Greg Kroah-Hartman,
	Sergei Shtylyov, IDE/ATA development list
In-Reply-To: <CAMHSBOU0tNyPzNuNyQkW2m+PpaoevZaZA4VTqRWO3jJB955qTw@mail.gmail.com>

I just tested this patch and it is working for me.

- Matthew

^ permalink raw reply

* Re: [PATCH] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems
From: Tejun Heo @ 2017-02-10 13:19 UTC (permalink / raw)
  To: whiteheadm, Gwendal Grignou
  Cc: One Thousand Gnomes, Greg Kroah-Hartman, Sergei Shtylyov,
	IDE/ATA development list
In-Reply-To: <CAP8WD_aQQ6gNLoiWZbFWR6y2A8gtV42J6ePvRm+9aHQLQhvMzA@mail.gmail.com>

On Thu, Feb 09, 2017 at 07:36:59PM -0500, tedheadster wrote:
> I just tested this patch and it is working for me.

Awesome, Gwendal, care to write up the path description?

Thanks.

-- 
tejun

^ permalink raw reply

* Re: [PATCH] PCI:MSI Return -ENOSPC when requested vectors is not enough
From: Bjorn Helgaas @ 2017-02-10 22:16 UTC (permalink / raw)
  To: Dennis Chen
  Cc: linux-pci, linux-ide, Lorenzo Pieralisi, Steve Capper,
	Marc Zyngier, Tom Long Nguyen, Bjorn Helgaas, Greg Kroah-Hartman,
	Tejun Heo, nd, Christoph Hellwig, linux-arm-kernel
In-Reply-To: <1480558504-18691-1-git-send-email-dennis.chen@arm.com>

On Thu, Dec 01, 2016 at 10:15:04AM +0800, Dennis Chen wrote:
> The __pci_enable_msi_range() should return -ENOSPC instead of -EINVAL
> when the device doesn't have enough vectors as required, just as the 
> MSI-X vector allocator does in __pci_enable_msix_range(). Otherwise, 
> some drivers depending on that return value will probably fallback to
> the legacy interrupt directly, for example, in commit 17a51f12cfbd2814
> ("ahci: only try to use multi-MSI mode if there is more than 1 port"), the
> ahci driver will fallback to single MSI mode only when the return value
> is -ENOSPC in case of required vectors is not enough, else the driver will
> use legacy interrupt which has been observed on a x86 box with 6-port SATA
> controller.
> 
> With this patch, when a MSI-capable device doesn't have enough MSI
> vectors as requested, it will fallback to single MSI mode while not
> legacy interrupt.
> 
> Signed-off-by: Dennis Chen <dennis.chen@arm.com>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Tom Long Nguyen <tom.l.nguyen@intel.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Steve Capper <steve.capper@arm.com>
> Cc: linux-ide@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org

Applied to pci/msi for v4.11, thanks, Dennis!

> ---
>  drivers/pci/msi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index ad70507..da37113 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -1084,7 +1084,7 @@ static int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec,
>  	if (nvec < 0)
>  		return nvec;
>  	if (nvec < minvec)
> -		return -EINVAL;
> +		return -ENOSPC;
>  
>  	if (nvec > maxvec)
>  		nvec = maxvec;
> -- 
> 2.7.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* DMA issue caused by vmapped stacks
From: Guillermo Amaral @ 2017-02-13  8:47 UTC (permalink / raw)
  To: linux-ide

Howdy,

I recently had some off-time and decided to look into why some of my
drives where completely failing to show up after v4.8-rc3, some with
odd DMA errors.

Turned out to be vmapped stacks!

Once CONFIG_VMAP_STACK got enabled by default in x86_64 (by commit
e37e43a), to be more precise.
I turned it off, and everything is back in working order.

I don't have a standard setup, so probably nobody else has run into
the same issue yet -- but if you want to replicate it: Get (or make)
an ATA locked drive, boot with or hot-swap said locked drive on a v4.9
kernel with CONFIG_VMAP_STACK set to Y.

On my systems (tested on two systems), the drive fails to get sensed
correctly and no SCSI nodes get created. This means no way to unlock
drives with hdparm (or in my case, via the kernel).

I will try to dig into this issue a bit more next weekend, I just
wanted to bring it up in case it hasn't been already.

Cheers,
G

-- 
gamaral

^ permalink raw reply

* [PATCH] cdrom: Make device operations read-only
From: Kees Cook @ 2017-02-14  0:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jens Axboe, Jonathan Corbet, Tim Waugh, Borislav Petkov,
	David S. Miller, James E.J. Bottomley, Martin K. Petersen,
	Kees Cook, linux-doc, linux-ide, linux-scsi, kernel-hardening

Since function tables are a common target for attackers, it's best to keep
them in read-only memory. As such, this makes the CDROM device ops tables
const. This drops additionally n_minors, since it isn't used meaningfully,
and sets the only user of cdrom_dummy_generic_packet explicitly so the
variables can all be const.

Inspired by similar changes in grsecurity/PaX.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 Documentation/cdrom/cdrom-standard.tex |  9 +-----
 drivers/block/paride/pcd.c             |  2 +-
 drivers/cdrom/cdrom.c                  | 58 ++++++++++++++++------------------
 drivers/cdrom/gdrom.c                  |  4 +--
 drivers/ide/ide-cd.c                   |  2 +-
 drivers/scsi/sr.c                      |  2 +-
 include/linux/cdrom.h                  |  5 +--
 7 files changed, 37 insertions(+), 45 deletions(-)

diff --git a/Documentation/cdrom/cdrom-standard.tex b/Documentation/cdrom/cdrom-standard.tex
index c06233fe52ac..8f85b0e41046 100644
--- a/Documentation/cdrom/cdrom-standard.tex
+++ b/Documentation/cdrom/cdrom-standard.tex
@@ -249,7 +249,6 @@ struct& cdrom_device_ops\ \{ \hidewidth\cr
         unsigned\ long);\cr
 \noalign{\medskip}
   &const\ int& capability;& capability flags \cr
-  &int& n_minors;& number of active minor devices \cr
 \};\cr
 }
 $$
@@ -258,13 +257,7 @@ it should add a function pointer to this $struct$. When a particular
 function is not implemented, however, this $struct$ should contain a
 NULL instead. The $capability$ flags specify the capabilities of the
 \cdrom\ hardware and/or low-level \cdrom\ driver when a \cdrom\ drive
-is registered with the \UCD. The value $n_minors$ should be a positive
-value indicating the number of minor devices that are supported by
-the low-level device driver, normally~1. Although these two variables
-are `informative' rather than `operational,' they are included in
-$cdrom_device_ops$ because they describe the capability of the {\em
-driver\/} rather than the {\em drive}. Nomenclature has always been
-difficult in computer programming.
+is registered with the \UCD.
 
 Note that most functions have fewer parameters than their
 $blkdev_fops$ counterparts. This is because very little of the
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 5fd2d0e25567..10aed84244f5 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -273,7 +273,7 @@ static const struct block_device_operations pcd_bdops = {
 	.check_events	= pcd_block_check_events,
 };
 
-static struct cdrom_device_ops pcd_dops = {
+static const struct cdrom_device_ops pcd_dops = {
 	.open		= pcd_open,
 	.release	= pcd_release,
 	.drive_status	= pcd_drive_status,
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 59cca72647a6..bbbd3caa927c 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -342,8 +342,8 @@ static void cdrom_sysctl_register(void);
 
 static LIST_HEAD(cdrom_list);
 
-static int cdrom_dummy_generic_packet(struct cdrom_device_info *cdi,
-				      struct packet_command *cgc)
+int cdrom_dummy_generic_packet(struct cdrom_device_info *cdi,
+			       struct packet_command *cgc)
 {
 	if (cgc->sense) {
 		cgc->sense->sense_key = 0x05;
@@ -354,6 +354,7 @@ static int cdrom_dummy_generic_packet(struct cdrom_device_info *cdi,
 	cgc->stat = -EIO;
 	return -EIO;
 }
+EXPORT_SYMBOL(cdrom_dummy_generic_packet);
 
 static int cdrom_flush_cache(struct cdrom_device_info *cdi)
 {
@@ -371,7 +372,7 @@ static int cdrom_flush_cache(struct cdrom_device_info *cdi)
 static int cdrom_get_disc_info(struct cdrom_device_info *cdi,
 			       disc_information *di)
 {
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 	struct packet_command cgc;
 	int ret, buflen;
 
@@ -586,7 +587,7 @@ static int cdrom_mrw_set_lba_space(struct cdrom_device_info *cdi, int space)
 int register_cdrom(struct cdrom_device_info *cdi)
 {
 	static char banner_printed;
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 	int *change_capability = (int *)&cdo->capability; /* hack */
 
 	cd_dbg(CD_OPEN, "entering register_cdrom\n");
@@ -610,7 +611,6 @@ int register_cdrom(struct cdrom_device_info *cdi)
 	ENSURE(reset, CDC_RESET);
 	ENSURE(generic_packet, CDC_GENERIC_PACKET);
 	cdi->mc_flags = 0;
-	cdo->n_minors = 0;
 	cdi->options = CDO_USE_FFLAGS;
 
 	if (autoclose == 1 && CDROM_CAN(CDC_CLOSE_TRAY))
@@ -630,8 +630,7 @@ int register_cdrom(struct cdrom_device_info *cdi)
 	else
 		cdi->cdda_method = CDDA_OLD;
 
-	if (!cdo->generic_packet)
-		cdo->generic_packet = cdrom_dummy_generic_packet;
+	WARN_ON(!cdo->generic_packet);
 
 	cd_dbg(CD_REG_UNREG, "drive \"/dev/%s\" registered\n", cdi->name);
 	mutex_lock(&cdrom_mutex);
@@ -652,7 +651,6 @@ void unregister_cdrom(struct cdrom_device_info *cdi)
 	if (cdi->exit)
 		cdi->exit(cdi);
 
-	cdi->ops->n_minors--;
 	cd_dbg(CD_REG_UNREG, "drive \"/dev/%s\" unregistered\n", cdi->name);
 }
 
@@ -1036,7 +1034,7 @@ static
 int open_for_data(struct cdrom_device_info *cdi)
 {
 	int ret;
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 	tracktype tracks;
 	cd_dbg(CD_OPEN, "entering open_for_data\n");
 	/* Check if the driver can report drive status.  If it can, we
@@ -1198,8 +1196,8 @@ int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev,
 /* This code is similar to that in open_for_data. The routine is called
    whenever an audio play operation is requested.
 */
-static int check_for_audio_disc(struct cdrom_device_info * cdi,
-				struct cdrom_device_ops * cdo)
+static int check_for_audio_disc(struct cdrom_device_info *cdi,
+				const struct cdrom_device_ops *cdo)
 {
         int ret;
 	tracktype tracks;
@@ -1254,7 +1252,7 @@ static int check_for_audio_disc(struct cdrom_device_info * cdi,
 
 void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode)
 {
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 	int opened_for_data;
 
 	cd_dbg(CD_CLOSE, "entering cdrom_release\n");
@@ -1294,7 +1292,7 @@ static int cdrom_read_mech_status(struct cdrom_device_info *cdi,
 				  struct cdrom_changer_info *buf)
 {
 	struct packet_command cgc;
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 	int length;
 
 	/*
@@ -1643,7 +1641,7 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)
 	int ret;
 	u_char buf[20];
 	struct packet_command cgc;
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 	rpc_state_t rpc_state;
 
 	memset(buf, 0, sizeof(buf));
@@ -1791,7 +1789,7 @@ static int dvd_read_physical(struct cdrom_device_info *cdi, dvd_struct *s,
 {
 	unsigned char buf[21], *base;
 	struct dvd_layer *layer;
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 	int ret, layer_num = s->physical.layer_num;
 
 	if (layer_num >= DVD_LAYERS)
@@ -1842,7 +1840,7 @@ static int dvd_read_copyright(struct cdrom_device_info *cdi, dvd_struct *s,
 {
 	int ret;
 	u_char buf[8];
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 
 	init_cdrom_command(cgc, buf, sizeof(buf), CGC_DATA_READ);
 	cgc->cmd[0] = GPCMD_READ_DVD_STRUCTURE;
@@ -1866,7 +1864,7 @@ static int dvd_read_disckey(struct cdrom_device_info *cdi, dvd_struct *s,
 {
 	int ret, size;
 	u_char *buf;
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 
 	size = sizeof(s->disckey.value) + 4;
 
@@ -1894,7 +1892,7 @@ static int dvd_read_bca(struct cdrom_device_info *cdi, dvd_struct *s,
 {
 	int ret, size = 4 + 188;
 	u_char *buf;
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 
 	buf = kmalloc(size, GFP_KERNEL);
 	if (!buf)
@@ -1928,7 +1926,7 @@ static int dvd_read_manufact(struct cdrom_device_info *cdi, dvd_struct *s,
 {
 	int ret = 0, size;
 	u_char *buf;
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 
 	size = sizeof(s->manufact.value) + 4;
 
@@ -1995,7 +1993,7 @@ int cdrom_mode_sense(struct cdrom_device_info *cdi,
 		     struct packet_command *cgc,
 		     int page_code, int page_control)
 {
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 
 	memset(cgc->cmd, 0, sizeof(cgc->cmd));
 
@@ -2010,7 +2008,7 @@ int cdrom_mode_sense(struct cdrom_device_info *cdi,
 int cdrom_mode_select(struct cdrom_device_info *cdi,
 		      struct packet_command *cgc)
 {
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 
 	memset(cgc->cmd, 0, sizeof(cgc->cmd));
 	memset(cgc->buffer, 0, 2);
@@ -2025,7 +2023,7 @@ int cdrom_mode_select(struct cdrom_device_info *cdi,
 static int cdrom_read_subchannel(struct cdrom_device_info *cdi,
 				 struct cdrom_subchnl *subchnl, int mcn)
 {
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 	struct packet_command cgc;
 	char buffer[32];
 	int ret;
@@ -2073,7 +2071,7 @@ static int cdrom_read_cd(struct cdrom_device_info *cdi,
 			 struct packet_command *cgc, int lba,
 			 int blocksize, int nblocks)
 {
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 
 	memset(&cgc->cmd, 0, sizeof(cgc->cmd));
 	cgc->cmd[0] = GPCMD_READ_10;
@@ -2093,7 +2091,7 @@ static int cdrom_read_block(struct cdrom_device_info *cdi,
 			    struct packet_command *cgc,
 			    int lba, int nblocks, int format, int blksize)
 {
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 
 	memset(&cgc->cmd, 0, sizeof(cgc->cmd));
 	cgc->cmd[0] = GPCMD_READ_CD;
@@ -2764,7 +2762,7 @@ static int cdrom_ioctl_audioctl(struct cdrom_device_info *cdi,
  */
 static int cdrom_switch_blocksize(struct cdrom_device_info *cdi, int size)
 {
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 	struct packet_command cgc;
 	struct modesel_head mh;
 
@@ -2790,7 +2788,7 @@ static int cdrom_switch_blocksize(struct cdrom_device_info *cdi, int size)
 static int cdrom_get_track_info(struct cdrom_device_info *cdi,
 				__u16 track, __u8 type, track_information *ti)
 {
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 	struct packet_command cgc;
 	int ret, buflen;
 
@@ -3049,7 +3047,7 @@ static noinline int mmc_ioctl_cdrom_play_msf(struct cdrom_device_info *cdi,
 					     void __user *arg,
 					     struct packet_command *cgc)
 {
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 	struct cdrom_msf msf;
 	cd_dbg(CD_DO_IOCTL, "entering CDROMPLAYMSF\n");
 	if (copy_from_user(&msf, (struct cdrom_msf __user *)arg, sizeof(msf)))
@@ -3069,7 +3067,7 @@ static noinline int mmc_ioctl_cdrom_play_blk(struct cdrom_device_info *cdi,
 					     void __user *arg,
 					     struct packet_command *cgc)
 {
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 	struct cdrom_blk blk;
 	cd_dbg(CD_DO_IOCTL, "entering CDROMPLAYBLK\n");
 	if (copy_from_user(&blk, (struct cdrom_blk __user *)arg, sizeof(blk)))
@@ -3164,7 +3162,7 @@ static noinline int mmc_ioctl_cdrom_start_stop(struct cdrom_device_info *cdi,
 					       struct packet_command *cgc,
 					       int cmd)
 {
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 	cd_dbg(CD_DO_IOCTL, "entering CDROMSTART/CDROMSTOP\n");
 	cgc->cmd[0] = GPCMD_START_STOP_UNIT;
 	cgc->cmd[1] = 1;
@@ -3177,7 +3175,7 @@ static noinline int mmc_ioctl_cdrom_pause_resume(struct cdrom_device_info *cdi,
 						 struct packet_command *cgc,
 						 int cmd)
 {
-	struct cdrom_device_ops *cdo = cdi->ops;
+	const struct cdrom_device_ops *cdo = cdi->ops;
 	cd_dbg(CD_DO_IOCTL, "entering CDROMPAUSE/CDROMRESUME\n");
 	cgc->cmd[0] = GPCMD_PAUSE_RESUME;
 	cgc->cmd[8] = (cmd == CDROMRESUME) ? 1 : 0;
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index 584bc3126403..f1a6e520ac6e 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -481,7 +481,7 @@ static int gdrom_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
 	return -EINVAL;
 }
 
-static struct cdrom_device_ops gdrom_ops = {
+static const struct cdrom_device_ops gdrom_ops = {
 	.open			= gdrom_open,
 	.release		= gdrom_release,
 	.drive_status		= gdrom_drivestatus,
@@ -489,9 +489,9 @@ static struct cdrom_device_ops gdrom_ops = {
 	.get_last_session	= gdrom_get_last_session,
 	.reset			= gdrom_hardreset,
 	.audio_ioctl		= gdrom_audio_ioctl,
+	.generic_packet		= cdrom_dummy_generic_packet,
 	.capability		= CDC_MULTI_SESSION | CDC_MEDIA_CHANGED |
 				  CDC_RESET | CDC_DRIVE_STATUS | CDC_CD_R,
-	.n_minors		= 1,
 };
 
 static int gdrom_bdops_open(struct block_device *bdev, fmode_t mode)
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 9cbd217bc0c9..ab9232e1e16f 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1166,7 +1166,7 @@ void ide_cdrom_update_speed(ide_drive_t *drive, u8 *buf)
 	 CDC_CD_RW | CDC_DVD | CDC_DVD_R | CDC_DVD_RAM | CDC_GENERIC_PACKET | \
 	 CDC_MO_DRIVE | CDC_MRW | CDC_MRW_W | CDC_RAM)
 
-static struct cdrom_device_ops ide_cdrom_dops = {
+static const struct cdrom_device_ops ide_cdrom_dops = {
 	.open			= ide_cdrom_open_real,
 	.release		= ide_cdrom_release_real,
 	.drive_status		= ide_cdrom_drive_status,
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 94352e4df831..013bfe049a48 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -117,7 +117,7 @@ static unsigned int sr_check_events(struct cdrom_device_info *cdi,
 				    unsigned int clearing, int slot);
 static int sr_packet(struct cdrom_device_info *, struct packet_command *);
 
-static struct cdrom_device_ops sr_dops = {
+static const struct cdrom_device_ops sr_dops = {
 	.open			= sr_open,
 	.release	 	= sr_release,
 	.drive_status	 	= sr_drive_status,
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index 8609d577bb66..6e8f209a6dff 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -36,7 +36,7 @@ struct packet_command
 
 /* Uniform cdrom data structures for cdrom.c */
 struct cdrom_device_info {
-	struct cdrom_device_ops  *ops;  /* link to device_ops */
+	const struct cdrom_device_ops *ops; /* link to device_ops */
 	struct list_head list;		/* linked list of all device_info */
 	struct gendisk *disk;		/* matching block layer disk */
 	void *handle;		        /* driver-dependent data */
@@ -87,7 +87,6 @@ struct cdrom_device_ops {
 
 /* driver specifications */
 	const int capability;   /* capability flags */
-	int n_minors;           /* number of active minor devices */
 	/* handle uniform packets for scsi type devices (scsi,atapi) */
 	int (*generic_packet) (struct cdrom_device_info *,
 			       struct packet_command *);
@@ -123,6 +122,8 @@ extern int cdrom_mode_sense(struct cdrom_device_info *cdi,
 			    int page_code, int page_control);
 extern void init_cdrom_command(struct packet_command *cgc,
 			       void *buffer, int len, int type);
+extern int cdrom_dummy_generic_packet(struct cdrom_device_info *cdi,
+				      struct packet_command *cgc);
 
 /* The SCSI spec says there could be 256 slots. */
 #define CDROM_MAX_SLOTS	256
-- 
2.7.4


-- 
Kees Cook
Pixel Security

^ permalink raw reply related

* Re: [PATCH] cdrom: Make device operations read-only
From: David Miller @ 2017-02-14  2:58 UTC (permalink / raw)
  To: keescook
  Cc: linux-kernel, axboe, corbet, tim, bp, jejb, martin.petersen,
	linux-doc, linux-ide, linux-scsi, kernel-hardening
In-Reply-To: <20170214002526.GA124769@beast>

From: Kees Cook <keescook@chromium.org>
Date: Mon, 13 Feb 2017 16:25:26 -0800

> diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
> index 9cbd217bc0c9..ab9232e1e16f 100644
> --- a/drivers/ide/ide-cd.c
> +++ b/drivers/ide/ide-cd.c
> @@ -1166,7 +1166,7 @@ void ide_cdrom_update_speed(ide_drive_t *drive, u8 *buf)
>  	 CDC_CD_RW | CDC_DVD | CDC_DVD_R | CDC_DVD_RAM | CDC_GENERIC_PACKET | \
>  	 CDC_MO_DRIVE | CDC_MRW | CDC_MRW_W | CDC_RAM)
>  
> -static struct cdrom_device_ops ide_cdrom_dops = {
> +static const struct cdrom_device_ops ide_cdrom_dops = {
>  	.open			= ide_cdrom_open_real,
>  	.release		= ide_cdrom_release_real,
>  	.drive_status		= ide_cdrom_drive_status,

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply

* Re: DMA issue caused by vmapped stacks
From: Christoph Hellwig @ 2017-02-14 12:27 UTC (permalink / raw)
  To: Guillermo Amaral; +Cc: linux-ide
In-Reply-To: <CAPeEpDroE2bYQ_viz7qExspordpR6gLYHjVxaJ53px3utz+PrA@mail.gmail.com>

Hi Guillermo,

are you using libata or the old IDE driver?  Any messages in the kernel
log that might be useful?

^ permalink raw reply

* Re: [PATCH] cdrom: Make device operations read-only
From: Jens Axboe @ 2017-02-14 15:30 UTC (permalink / raw)
  To: Kees Cook, linux-kernel
  Cc: Jonathan Corbet, Tim Waugh, Borislav Petkov, David S. Miller,
	James E.J. Bottomley, Martin K. Petersen, linux-doc, linux-ide,
	linux-scsi, kernel-hardening
In-Reply-To: <20170214002526.GA124769@beast>

On 02/13/2017 05:25 PM, Kees Cook wrote:
> Since function tables are a common target for attackers, it's best to keep
> them in read-only memory. As such, this makes the CDROM device ops tables
> const. This drops additionally n_minors, since it isn't used meaningfully,
> and sets the only user of cdrom_dummy_generic_packet explicitly so the
> variables can all be const.

Agree, it's a good change. Applied for 4.11.

-- 
Jens Axboe


^ permalink raw reply

* [RESEND][PATCH v2] ata: xgene: Enable NCQ support for APM X-Gene SATA controller hardware v1.1
From: Rameshwar Prasad Sahu @ 2017-02-14 17:53 UTC (permalink / raw)
  To: olof, tj, arnd
  Cc: devicetree, mlangsdo, linux-scsi, jcm, Rameshwar Prasad Sahu,
	patches, linux-ide, linux-arm-kernel

This patch enables NCQ support for APM X-Gene SATA controller hardware v1.1
that was broken with hardware v1.0. Second thing, here we should not assume
XGENE_AHCI_V2 always in case of having valid _CID in ACPI table. I need to
remove this assumption because V1_1 also has a valid _CID for backward
compatibly with v1.

v2 changes:
	1. Changed patch description

Signed-off-by: Rameshwar Prasad Sahu <rsahu@apm.com>
---
 drivers/ata/ahci_xgene.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
index 73b19b2..8b88be9 100644
--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -87,6 +87,7 @@

 enum xgene_ahci_version {
 	XGENE_AHCI_V1 = 1,
+	XGENE_AHCI_V1_1,
 	XGENE_AHCI_V2,
 };

@@ -734,6 +735,7 @@ static struct scsi_host_template ahci_platform_sht = {
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id xgene_ahci_acpi_match[] = {
 	{ "APMC0D0D", XGENE_AHCI_V1},
+	{ "APMC0D67", XGENE_AHCI_V1_1},
 	{ "APMC0D32", XGENE_AHCI_V2},
 	{},
 };
@@ -742,6 +744,7 @@ MODULE_DEVICE_TABLE(acpi, xgene_ahci_acpi_match);

 static const struct of_device_id xgene_ahci_of_match[] = {
 	{.compatible = "apm,xgene-ahci", .data = (void *) XGENE_AHCI_V1},
+	{.compatible = "apm,xgene-ahci-v1-1", .data = (void *) XGENE_AHCI_V1_1},
 	{.compatible = "apm,xgene-ahci-v2", .data = (void *) XGENE_AHCI_V2},
 	{},
 };
@@ -755,8 +758,7 @@ static int xgene_ahci_probe(struct platform_device *pdev)
 	struct resource *res;
 	const struct of_device_id *of_devid;
 	enum xgene_ahci_version version = XGENE_AHCI_V1;
-	const struct ata_port_info *ppi[] = { &xgene_ahci_v1_port_info,
-					      &xgene_ahci_v2_port_info };
+	const struct ata_port_info *ppi;
 	int rc;

 	hpriv = ahci_platform_get_resources(pdev);
@@ -821,8 +823,6 @@ static int xgene_ahci_probe(struct platform_device *pdev)
 				dev_warn(&pdev->dev, "%s: Error reading device info. Assume version1\n",
 					__func__);
 				version = XGENE_AHCI_V1;
-			} else if (info->valid & ACPI_VALID_CID) {
-				version = XGENE_AHCI_V2;
 			}
 		}
 	}
@@ -858,18 +858,20 @@ skip_clk_phy:

 	switch (version) {
 	case XGENE_AHCI_V1:
+		ppi = &xgene_ahci_v1_port_info;
 		hpriv->flags = AHCI_HFLAG_NO_NCQ;
 		break;
 	case XGENE_AHCI_V2:
+		ppi = &xgene_ahci_v2_port_info;
 		hpriv->flags |= AHCI_HFLAG_YES_FBS;
 		hpriv->irq_handler = xgene_ahci_irq_intr;
 		break;
 	default:
+		ppi = &xgene_ahci_v1_port_info;
 		break;
 	}

-	rc = ahci_platform_init_host(pdev, hpriv, ppi[version - 1],
-				     &ahci_platform_sht);
+	rc = ahci_platform_init_host(pdev, hpriv, ppi, &ahci_platform_sht);
 	if (rc)
 		goto disable_resources;

--
1.7.1

^ permalink raw reply related

* КЛИЕНСКИЕ БАЗЫ тел +79139230330 Skype: prodawez390 Email: prodawez393@gmail.com Viber\whatsapp\telegram +79139230330 Узнайте подробнее!!!
From: linux-ide @ 2017-02-14 18:37 UTC (permalink / raw)
  To: linux-ide



^ permalink raw reply

* Re: [PATCH 0/3] ata: add m68k/Atari Falcon PATA support
From: Geert Uytterhoeven @ 2017-02-15  8:45 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: Tejun Heo, Michael Schmitz, linux-ide@vger.kernel.org, linux-m68k,
	linux-kernel@vger.kernel.org, Jens Axboe
In-Reply-To: <1483106478-1382-1-git-send-email-b.zolnierkie@samsung.com>

On Fri, Dec 30, 2016 at 3:01 PM, Bartlomiej Zolnierkiewicz
<b.zolnierkie@samsung.com> wrote:
> This patchset adds m68k/Atari Falcon PATA support to libata.
> The major difference in the new libata's pata_falcon host
> driver when compared to legacy IDE's falconide host driver is
> that we are using polled PIO mode and thus avoiding the need
> for STDMA locking magic altogether.
>
> Tested under ARAnyM emulator.
>
> Best regards,
> --
> Bartlomiej Zolnierkiewicz
> Samsung R&D Institute Poland
> Samsung Electronics
>
>
> Bartlomiej Zolnierkiewicz (3):
>   ata: allow subsystem to be used on m68k arch
>   ata: pass queued command to ->sff_data_xfer method
>   ata: add Atari Falcon PATA controller driver

drivers/ata/pata_falcon.c:57:18: error: 'struct request' has no member
named 'cmd_type'
drivers/ata/pata_falcon.c:57:32: error: 'REQ_TYPE_FS' undeclared
(first use in this function)

http://kisskb.ellerman.id.au/kisskb/buildresult/12936876/

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply

* [PATCH 00/35] treewide trivial patches converting pr_warning to pr_warn
From: Joe Perches @ 2017-02-17  7:11 UTC (permalink / raw)
  To: Alexander Shishkin, Karol Herbst, Pekka Paalanen,
	Richard Weinberger, Fabio Estevam, linux-kernel, linux-arm-kernel,
	linuxppc-dev, tboot-devel, nouveau, oprofile-list, sfi-devel,
	xen-devel, linux-acpi, drbd-dev, virtualization, linux-crypto,
	linux-ide, gigaset307x-common, linux-media, linux-omap, linux-mtd,
	devicetree, acpi4asus-user, platform-driver-x86, linux-scsi
  Cc: linux-ia64, linux-sh, netdev, linux-input, adi-buildroot-devel,
	amd-gfx, dri-devel, linux-alpha, sparclinux

There are ~4300 uses of pr_warn and ~250 uses of the older
pr_warning in the kernel source tree.

Make the use of pr_warn consistent across all kernel files.

This excludes all files in tools/ as there is a separate
define pr_warning for that directory tree and pr_warn is
not used in tools/.

Done with 'sed s/\bpr_warning\b/pr_warn/' and some emacsing.

Miscellanea:

o Coalesce formats and realign arguments

Some files not compiled - no cross-compilers

Joe Perches (35):
  alpha: Convert remaining uses of pr_warning to pr_warn
  ARM: ep93xx: Convert remaining uses of pr_warning to pr_warn
  arm64: Convert remaining uses of pr_warning to pr_warn
  arch/blackfin: Convert remaining uses of pr_warning to pr_warn
  ia64: Convert remaining use of pr_warning to pr_warn
  powerpc: Convert remaining uses of pr_warning to pr_warn
  sh: Convert remaining uses of pr_warning to pr_warn
  sparc: Convert remaining use of pr_warning to pr_warn
  x86: Convert remaining uses of pr_warning to pr_warn
  drivers/acpi: Convert remaining uses of pr_warning to pr_warn
  block/drbd: Convert remaining uses of pr_warning to pr_warn
  gdrom: Convert remaining uses of pr_warning to pr_warn
  drivers/char: Convert remaining use of pr_warning to pr_warn
  clocksource: Convert remaining use of pr_warning to pr_warn
  drivers/crypto: Convert remaining uses of pr_warning to pr_warn
  fmc: Convert remaining use of pr_warning to pr_warn
  drivers/gpu: Convert remaining uses of pr_warning to pr_warn
  drivers/ide: Convert remaining uses of pr_warning to pr_warn
  drivers/input: Convert remaining uses of pr_warning to pr_warn
  drivers/isdn: Convert remaining uses of pr_warning to pr_warn
  drivers/macintosh: Convert remaining uses of pr_warning to pr_warn
  drivers/media: Convert remaining use of pr_warning to pr_warn
  drivers/mfd: Convert remaining uses of pr_warning to pr_warn
  drivers/mtd: Convert remaining uses of pr_warning to pr_warn
  drivers/of: Convert remaining uses of pr_warning to pr_warn
  drivers/oprofile: Convert remaining uses of pr_warning to pr_warn
  drivers/platform: Convert remaining uses of pr_warning to pr_warn
  drivers/rapidio: Convert remaining use of pr_warning to pr_warn
  drivers/scsi: Convert remaining use of pr_warning to pr_warn
  drivers/sh: Convert remaining use of pr_warning to pr_warn
  drivers/tty: Convert remaining uses of pr_warning to pr_warn
  drivers/video: Convert remaining uses of pr_warning to pr_warn
  kernel/trace: Convert remaining uses of pr_warning to pr_warn
  lib: Convert remaining uses of pr_warning to pr_warn
  sound/soc: Convert remaining uses of pr_warning to pr_warn

 arch/alpha/kernel/perf_event.c                     |  4 +-
 arch/arm/mach-ep93xx/core.c                        |  4 +-
 arch/arm64/include/asm/syscall.h                   |  8 ++--
 arch/arm64/kernel/hw_breakpoint.c                  |  8 ++--
 arch/arm64/kernel/smp.c                            |  4 +-
 arch/blackfin/kernel/nmi.c                         |  2 +-
 arch/blackfin/kernel/ptrace.c                      |  2 +-
 arch/blackfin/mach-bf533/boards/stamp.c            |  2 +-
 arch/blackfin/mach-bf537/boards/cm_bf537e.c        |  2 +-
 arch/blackfin/mach-bf537/boards/cm_bf537u.c        |  2 +-
 arch/blackfin/mach-bf537/boards/stamp.c            |  2 +-
 arch/blackfin/mach-bf537/boards/tcm_bf537.c        |  2 +-
 arch/blackfin/mach-bf561/boards/cm_bf561.c         |  2 +-
 arch/blackfin/mach-bf561/boards/ezkit.c            |  2 +-
 arch/blackfin/mm/isram-driver.c                    |  4 +-
 arch/ia64/kernel/setup.c                           |  6 +--
 arch/powerpc/kernel/pci-common.c                   |  4 +-
 arch/powerpc/mm/init_64.c                          |  5 +--
 arch/powerpc/mm/mem.c                              |  3 +-
 arch/powerpc/platforms/512x/mpc512x_shared.c       |  4 +-
 arch/powerpc/platforms/85xx/socrates_fpga_pic.c    |  7 ++--
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c         |  2 +-
 arch/powerpc/platforms/pasemi/dma_lib.c            |  4 +-
 arch/powerpc/platforms/powernv/opal.c              |  8 ++--
 arch/powerpc/platforms/powernv/pci-ioda.c          | 10 ++---
 arch/powerpc/platforms/ps3/device-init.c           | 14 +++----
 arch/powerpc/platforms/ps3/mm.c                    |  4 +-
 arch/powerpc/platforms/ps3/os-area.c               |  2 +-
 arch/powerpc/platforms/pseries/iommu.c             |  8 ++--
 arch/powerpc/platforms/pseries/setup.c             |  4 +-
 arch/powerpc/sysdev/fsl_pci.c                      |  9 ++---
 arch/powerpc/sysdev/mpic.c                         | 10 ++---
 arch/powerpc/sysdev/xics/icp-native.c              | 10 ++---
 arch/powerpc/sysdev/xics/ics-opal.c                |  4 +-
 arch/powerpc/sysdev/xics/ics-rtas.c                |  4 +-
 arch/powerpc/sysdev/xics/xics-common.c             |  8 ++--
 arch/sh/boards/mach-sdk7786/nmi.c                  |  2 +-
 arch/sh/drivers/pci/fixups-sdk7786.c               |  2 +-
 arch/sh/kernel/io_trapped.c                        |  2 +-
 arch/sh/kernel/setup.c                             |  2 +-
 arch/sh/mm/consistent.c                            |  5 +--
 arch/sparc/kernel/smp_64.c                         |  5 +--
 arch/x86/kernel/amd_gart_64.c                      | 12 ++----
 arch/x86/kernel/apic/apic.c                        | 46 ++++++++++------------
 arch/x86/kernel/apic/apic_noop.c                   |  2 +-
 arch/x86/kernel/setup_percpu.c                     |  4 +-
 arch/x86/kernel/tboot.c                            | 15 ++++---
 arch/x86/kernel/tsc_sync.c                         |  8 ++--
 arch/x86/mm/kmmio.c                                |  8 ++--
 arch/x86/mm/mmio-mod.c                             |  5 +--
 arch/x86/mm/numa.c                                 | 12 +++---
 arch/x86/mm/numa_emulation.c                       |  6 +--
 arch/x86/mm/testmmiotrace.c                        |  5 +--
 arch/x86/oprofile/op_x86_model.h                   |  6 +--
 arch/x86/platform/olpc/olpc-xo15-sci.c             |  2 +-
 arch/x86/platform/sfi/sfi.c                        |  3 +-
 arch/x86/xen/debugfs.c                             |  2 +-
 arch/x86/xen/setup.c                               |  2 +-
 drivers/acpi/apei/apei-base.c                      | 32 +++++++--------
 drivers/acpi/apei/einj.c                           |  4 +-
 drivers/acpi/apei/erst-dbg.c                       |  4 +-
 drivers/acpi/apei/ghes.c                           | 30 +++++++-------
 drivers/acpi/apei/hest.c                           | 10 ++---
 drivers/acpi/resource.c                            |  4 +-
 drivers/block/drbd/drbd_nl.c                       | 13 +++---
 drivers/cdrom/gdrom.c                              |  4 +-
 drivers/char/virtio_console.c                      |  2 +-
 drivers/clocksource/samsung_pwm_timer.c            |  4 +-
 drivers/crypto/n2_core.c                           | 12 +++---
 drivers/fmc/fmc-fakedev.c                          |  2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  2 +-
 drivers/gpu/drm/amd/powerplay/inc/pp_debug.h       |  2 +-
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c    |  4 +-
 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c | 14 +++----
 .../gpu/drm/amd/powerplay/smumgr/polaris10_smc.c   |  4 +-
 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c   |  4 +-
 drivers/ide/tx4938ide.c                            |  2 +-
 drivers/ide/tx4939ide.c                            |  5 +--
 drivers/input/gameport/gameport.c                  |  4 +-
 drivers/input/joystick/gamecon.c                   |  3 +-
 drivers/input/misc/apanel.c                        |  3 +-
 drivers/input/misc/xen-kbdfront.c                  |  8 ++--
 drivers/input/serio/serio.c                        |  8 ++--
 drivers/isdn/gigaset/interface.c                   |  2 +-
 drivers/isdn/hardware/mISDN/avmfritz.c             | 17 ++++----
 drivers/isdn/hardware/mISDN/hfcmulti.c             |  8 ++--
 drivers/isdn/hardware/mISDN/hfcpci.c               |  4 +-
 drivers/isdn/hardware/mISDN/hfcsusb.c              |  4 +-
 drivers/isdn/hardware/mISDN/mISDNipac.c            |  4 +-
 drivers/isdn/hardware/mISDN/mISDNisar.c            | 10 ++---
 drivers/isdn/hardware/mISDN/netjet.c               |  8 ++--
 drivers/isdn/hardware/mISDN/w6692.c                | 12 +++---
 drivers/isdn/mISDN/hwchannel.c                     |  8 ++--
 drivers/macintosh/windfarm_fcu_controls.c          |  5 +--
 drivers/macintosh/windfarm_lm87_sensor.c           |  4 +-
 drivers/macintosh/windfarm_pm72.c                  | 22 +++++------
 drivers/macintosh/windfarm_rm31.c                  |  6 +--
 drivers/media/platform/sh_vou.c                    |  4 +-
 drivers/mfd/db8500-prcmu.c                         |  2 +-
 drivers/mfd/sta2x11-mfd.c                          |  4 +-
 drivers/mfd/twl4030-power.c                        |  7 +---
 drivers/mtd/chips/cfi_cmdset_0002.c                | 12 ++++--
 drivers/mtd/nand/cmx270_nand.c                     |  4 +-
 drivers/mtd/ofpart.c                               |  4 +-
 drivers/of/fdt.c                                   | 20 +++++-----
 drivers/oprofile/oprofile_perf.c                   |  8 ++--
 drivers/platform/x86/asus-laptop.c                 |  2 +-
 drivers/platform/x86/eeepc-laptop.c                |  2 +-
 drivers/platform/x86/intel_oaktrail.c              | 10 ++---
 drivers/rapidio/rio-sysfs.c                        |  4 +-
 drivers/scsi/a3000.c                               |  2 +-
 drivers/sh/intc/core.c                             |  4 +-
 drivers/tty/hvc/hvcs.c                             |  2 +-
 drivers/tty/tty_io.c                               |  4 +-
 drivers/video/fbdev/aty/radeon_base.c              |  4 +-
 drivers/video/fbdev/core/fbmon.c                   |  4 +-
 drivers/video/fbdev/pxafb.c                        |  7 ++--
 kernel/trace/trace_benchmark.c                     |  4 +-
 lib/cpu_rmap.c                                     |  2 +-
 lib/dma-debug.c                                    |  2 +-
 sound/soc/fsl/imx-audmux.c                         |  6 +--
 sound/soc/samsung/s3c-i2s-v2.c                     |  6 +--
 122 files changed, 367 insertions(+), 397 deletions(-)

-- 
2.10.0.rc2.1.g053435c


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply

* [PATCH 18/35] drivers/ide: Convert remaining uses of pr_warning to pr_warn
From: Joe Perches @ 2017-02-17  7:11 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-ide, linux-kernel
In-Reply-To: <cover.1487314666.git.joe@perches.com>

To enable eventual removal of pr_warning

This makes pr_warn use consistent for drivers/ide

Prior to this patch, there were 2 uses of pr_warning and
0 uses of pr_warn in drivers/ide

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/ide/tx4938ide.c | 2 +-
 drivers/ide/tx4939ide.c | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
index 40a3f55b08dd..962eb92501b5 100644
--- a/drivers/ide/tx4938ide.c
+++ b/drivers/ide/tx4938ide.c
@@ -46,7 +46,7 @@ static void tx4938ide_tune_ebusc(unsigned int ebus_ch,
 	while ((shwt * 4 + wt + (wt ? 2 : 3)) * cycle < t->cycle)
 		shwt++;
 	if (shwt > 7) {
-		pr_warning("tx4938ide: SHWT violation (%d)\n", shwt);
+		pr_warn("tx4938ide: SHWT violation (%d)\n", shwt);
 		shwt = 7;
 	}
 	pr_debug("tx4938ide: ebus %d, bus cycle %dns, WT %d, SHWT %d\n",
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c
index 67d4a7d4acc8..7fa4ff6fc099 100644
--- a/drivers/ide/tx4939ide.c
+++ b/drivers/ide/tx4939ide.c
@@ -364,9 +364,8 @@ static int tx4939ide_dma_test_irq(ide_drive_t *drive)
 	case TX4939IDE_INT_HOST | TX4939IDE_INT_XFEREND:
 		dma_stat = tx4939ide_readb(base, TX4939IDE_DMA_Stat);
 		if (!(dma_stat & ATA_DMA_INTR))
-			pr_warning("%s: weird interrupt status. "
-				   "DMA_Stat %#02x int_ctl %#04x\n",
-				   hwif->name, dma_stat, ctl);
+			pr_warn("%s: weird interrupt status. DMA_Stat %#02x int_ctl %#04x\n",
+				hwif->name, dma_stat, ctl);
 		found = 1;
 		break;
 	}
-- 
2.10.0.rc2.1.g053435c

^ permalink raw reply related

* [PATCH] pata: remove the at91 driver
From: Boris Brezillon @ 2017-02-17  9:36 UTC (permalink / raw)
  To: Nicolas Ferre, Alexandre Belloni, Tejun Heo,
	Bartlomiej Zolnierkiewicz, linux-ide
  Cc: linux-arm-kernel, linux-kernel, Boris Brezillon

This driver is orphan since commit 2e591e7b3ac2 ("ARM: at91: remove
at91sam9261/at91sam9g10 legacy board support"). Given that nobody cared
adding DT support to it, it probably means it's no longer used and is
thus a good candidate for removal.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
Note that I'm removing this driver because I plan to rework the macro
definitions in atmel-smc.h, and some of them are used in this driver.
Since I can't test it, and this drivers is not used anymore, it's probably
better to remove it.
---
 drivers/ata/Kconfig     |   8 -
 drivers/ata/Makefile    |   1 -
 drivers/ata/pata_at91.c | 503 ------------------------------------------------
 3 files changed, 512 deletions(-)
 delete mode 100644 drivers/ata/pata_at91.c

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 2c8be74f401d..cbf871dabcb5 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -877,14 +877,6 @@ config PATA_AT32
 
 	  If unsure, say N.
 
-config PATA_AT91
-	tristate "PATA support for AT91SAM9260"
-	depends on ARM && SOC_AT91SAM9
-	help
-	  This option enables support for IDE devices on the Atmel AT91SAM9260 SoC.
-
-	  If unsure, say N.
-
 config PATA_CMD640_PCI
 	tristate "CMD640 PCI PATA support (Experimental)"
 	depends on PCI
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index a46e6b784bda..c5c09e34f2eb 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -91,7 +91,6 @@ obj-$(CONFIG_PATA_WINBOND)	+= pata_sl82c105.o
 
 # SFF PIO only
 obj-$(CONFIG_PATA_AT32)		+= pata_at32.o
-obj-$(CONFIG_PATA_AT91)		+= pata_at91.o
 obj-$(CONFIG_PATA_CMD640_PCI)	+= pata_cmd640.o
 obj-$(CONFIG_PATA_ISAPNP)	+= pata_isapnp.o
 obj-$(CONFIG_PATA_IXP4XX_CF)	+= pata_ixp4xx_cf.o
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c
deleted file mode 100644
index 1611e0e8d767..000000000000
--- a/drivers/ata/pata_at91.c
+++ /dev/null
@@ -1,503 +0,0 @@
-/*
- * PATA driver for AT91SAM9260 Static Memory Controller
- * with CompactFlash interface in True IDE mode
- *
- * Copyright (C) 2009 Matyukevich Sergey
- *               2011 Igor Plyatov
- *
- * Based on:
- *      * generic platform driver by Paul Mundt: drivers/ata/pata_platform.c
- *      * pata_at32 driver by Kristoffer Nyborg Gregertsen
- *      * at91_ide driver by Stanislaw Gruszka
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/blkdev.h>
-#include <linux/gfp.h>
-#include <scsi/scsi_host.h>
-#include <linux/ata.h>
-#include <linux/clk.h>
-#include <linux/libata.h>
-#include <linux/mfd/syscon.h>
-#include <linux/mfd/syscon/atmel-smc.h>
-#include <linux/platform_device.h>
-#include <linux/ata_platform.h>
-#include <linux/platform_data/atmel.h>
-#include <linux/regmap.h>
-#include <linux/gpio.h>
-
-#define DRV_NAME		"pata_at91"
-#define DRV_VERSION		"0.3"
-
-#define CF_IDE_OFFSET		0x00c00000
-#define CF_ALT_IDE_OFFSET	0x00e00000
-#define CF_IDE_RES_SIZE		0x08
-#define CS_PULSE_MAXIMUM	319
-#define ER_SMC_CALC		1
-#define ER_SMC_RECALC		2
-
-struct at91_ide_info {
-	unsigned long mode;
-	unsigned int cs;
-	struct clk *mck;
-	void __iomem *ide_addr;
-	void __iomem *alt_addr;
-};
-
-/**
- * struct smc_range - range of valid values for SMC register.
- */
-struct smc_range {
-	int min;
-	int max;
-};
-
-struct regmap *smc;
-
-struct at91sam9_smc_generic_fields {
-	struct regmap_field *setup;
-	struct regmap_field *pulse;
-	struct regmap_field *cycle;
-	struct regmap_field *mode;
-} fields;
-
-/**
- * adjust_smc_value - adjust value for one of SMC registers.
- * @value: adjusted value
- * @range: array of SMC ranges with valid values
- * @size: SMC ranges array size
- *
- * This returns the difference between input and output value or negative
- * in case of invalid input value.
- * If negative returned, then output value = maximal possible from ranges.
- */
-static int adjust_smc_value(int *value, struct smc_range *range, int size)
-{
-	int maximum = (range + size - 1)->max;
-	int remainder;
-
-	do {
-		if (*value < range->min) {
-			remainder = range->min - *value;
-			*value = range->min; /* nearest valid value */
-			return remainder;
-		} else if ((range->min <= *value) && (*value <= range->max))
-			return 0;
-
-		range++;
-	} while (--size);
-	*value = maximum;
-
-	return -1; /* invalid value */
-}
-
-/**
- * calc_smc_vals - calculate SMC register values
- * @dev: ATA device
- * @setup: SMC_SETUP register value
- * @pulse: SMC_PULSE register value
- * @cycle: SMC_CYCLE register value
- *
- * This returns negative in case of invalid values for SMC registers:
- * -ER_SMC_RECALC - recalculation required for SMC values,
- * -ER_SMC_CALC - calculation failed (invalid input values).
- *
- * SMC use special coding scheme, see "Coding and Range of Timing
- * Parameters" table from AT91SAM9 datasheets.
- *
- *	SMC_SETUP = 128*setup[5] + setup[4:0]
- *	SMC_PULSE = 256*pulse[6] + pulse[5:0]
- *	SMC_CYCLE = 256*cycle[8:7] + cycle[6:0]
- */
-static int calc_smc_vals(struct device *dev,
-		int *setup, int *pulse, int *cycle, int *cs_pulse)
-{
-	int ret_val;
-	int err = 0;
-	struct smc_range range_setup[] = {	/* SMC_SETUP valid values */
-		{.min = 0,	.max = 31},	/* first  range */
-		{.min = 128,	.max = 159}	/* second range */
-	};
-	struct smc_range range_pulse[] = {	/* SMC_PULSE valid values */
-		{.min = 0,	.max = 63},	/* first  range */
-		{.min = 256,	.max = 319}	/* second range */
-	};
-	struct smc_range range_cycle[] = {	/* SMC_CYCLE valid values */
-		{.min = 0,	.max = 127},	/* first  range */
-		{.min = 256,	.max = 383},	/* second range */
-		{.min = 512,	.max = 639},	/* third  range */
-		{.min = 768,	.max = 895}	/* fourth range */
-	};
-
-	ret_val = adjust_smc_value(setup, range_setup, ARRAY_SIZE(range_setup));
-	if (ret_val < 0)
-		dev_warn(dev, "maximal SMC Setup value\n");
-	else
-		*cycle += ret_val;
-
-	ret_val = adjust_smc_value(pulse, range_pulse, ARRAY_SIZE(range_pulse));
-	if (ret_val < 0)
-		dev_warn(dev, "maximal SMC Pulse value\n");
-	else
-		*cycle += ret_val;
-
-	ret_val = adjust_smc_value(cycle, range_cycle, ARRAY_SIZE(range_cycle));
-	if (ret_val < 0)
-		dev_warn(dev, "maximal SMC Cycle value\n");
-
-	*cs_pulse = *cycle;
-	if (*cs_pulse > CS_PULSE_MAXIMUM) {
-		dev_err(dev, "unable to calculate valid SMC settings\n");
-		return -ER_SMC_CALC;
-	}
-
-	ret_val = adjust_smc_value(cs_pulse, range_pulse,
-					ARRAY_SIZE(range_pulse));
-	if (ret_val < 0) {
-		dev_warn(dev, "maximal SMC CS Pulse value\n");
-	} else if (ret_val != 0) {
-		*cycle = *cs_pulse;
-		dev_warn(dev, "SMC Cycle extended\n");
-		err = -ER_SMC_RECALC;
-	}
-
-	return err;
-}
-
-/**
- * to_smc_format - convert values into SMC format
- * @setup: SETUP value of SMC Setup Register
- * @pulse: PULSE value of SMC Pulse Register
- * @cycle: CYCLE value of SMC Cycle Register
- * @cs_pulse: NCS_PULSE value of SMC Pulse Register
- */
-static void to_smc_format(int *setup, int *pulse, int *cycle, int *cs_pulse)
-{
-	*setup = (*setup & 0x1f) | ((*setup & 0x80) >> 2);
-	*pulse = (*pulse & 0x3f) | ((*pulse & 0x100) >> 2);
-	*cycle = (*cycle & 0x7f) | ((*cycle & 0x300) >> 1);
-	*cs_pulse = (*cs_pulse & 0x3f) | ((*cs_pulse & 0x100) >> 2);
-}
-
-static unsigned long calc_mck_cycles(unsigned long ns, unsigned long mck_hz)
-{
-	unsigned long mul;
-
-	/*
-	* cycles = x [nsec] * f [Hz] / 10^9 [ns in sec] =
-	*     x * (f / 1_000_000_000) =
-	*     x * ((f * 65536) / 1_000_000_000) / 65536 =
-	*     x * (((f / 10_000) * 65536) / 100_000) / 65536 =
-	*/
-
-	mul = (mck_hz / 10000) << 16;
-	mul /= 100000;
-
-	return (ns * mul + 65536) >> 16;    /* rounding */
-}
-
-/**
- * set_smc_timing - SMC timings setup.
- * @dev: device
- * @info: AT91 IDE info
- * @ata: ATA timings
- *
- * Its assumed that write timings are same as read timings,
- * cs_setup = 0 and cs_pulse = cycle.
- */
-static void set_smc_timing(struct device *dev, struct ata_device *adev,
-		struct at91_ide_info *info, const struct ata_timing *ata)
-{
-	int ret = 0;
-	int use_iordy;
-	unsigned int t6z;         /* data tristate time in ns */
-	unsigned int cycle;       /* SMC Cycle width in MCK ticks */
-	unsigned int setup;       /* SMC Setup width in MCK ticks */
-	unsigned int pulse;       /* CFIOR and CFIOW pulse width in MCK ticks */
-	unsigned int cs_pulse;    /* CS4 or CS5 pulse width in MCK ticks*/
-	unsigned int tdf_cycles;  /* SMC TDF MCK ticks */
-	unsigned long mck_hz;     /* MCK frequency in Hz */
-
-	t6z = (ata->mode < XFER_PIO_5) ? 30 : 20;
-	mck_hz = clk_get_rate(info->mck);
-	cycle = calc_mck_cycles(ata->cyc8b, mck_hz);
-	setup = calc_mck_cycles(ata->setup, mck_hz);
-	pulse = calc_mck_cycles(ata->act8b, mck_hz);
-	tdf_cycles = calc_mck_cycles(t6z, mck_hz);
-
-	do {
-		ret = calc_smc_vals(dev, &setup, &pulse, &cycle, &cs_pulse);
-	} while (ret == -ER_SMC_RECALC);
-
-	if (ret == -ER_SMC_CALC)
-		dev_err(dev, "Interface may not operate correctly\n");
-
-	dev_dbg(dev, "SMC Setup=%u, Pulse=%u, Cycle=%u, CS Pulse=%u\n",
-		setup, pulse, cycle, cs_pulse);
-	to_smc_format(&setup, &pulse, &cycle, &cs_pulse);
-	/* disable or enable waiting for IORDY signal */
-	use_iordy = ata_pio_need_iordy(adev);
-	if (use_iordy)
-		info->mode |= AT91_SMC_EXNWMODE_READY;
-
-	if (tdf_cycles > 15) {
-		tdf_cycles = 15;
-		dev_warn(dev, "maximal SMC TDF Cycles value\n");
-	}
-
-	dev_dbg(dev, "Use IORDY=%u, TDF Cycles=%u\n", use_iordy, tdf_cycles);
-
-	regmap_fields_write(fields.setup, info->cs,
-			    AT91SAM9_SMC_NRDSETUP(setup) |
-			    AT91SAM9_SMC_NWESETUP(setup) |
-			    AT91SAM9_SMC_NCS_NRDSETUP(0) |
-			    AT91SAM9_SMC_NCS_WRSETUP(0));
-	regmap_fields_write(fields.pulse, info->cs,
-			    AT91SAM9_SMC_NRDPULSE(pulse) |
-			    AT91SAM9_SMC_NWEPULSE(pulse) |
-			    AT91SAM9_SMC_NCS_NRDPULSE(cs_pulse) |
-			    AT91SAM9_SMC_NCS_WRPULSE(cs_pulse));
-	regmap_fields_write(fields.cycle, info->cs,
-			    AT91SAM9_SMC_NRDCYCLE(cycle) |
-			    AT91SAM9_SMC_NWECYCLE(cycle));
-	regmap_fields_write(fields.mode, info->cs, info->mode |
-			    AT91_SMC_TDF_(tdf_cycles));
-}
-
-static void pata_at91_set_piomode(struct ata_port *ap, struct ata_device *adev)
-{
-	struct at91_ide_info *info = ap->host->private_data;
-	struct ata_timing timing;
-	int ret;
-
-	/* Compute ATA timing and set it to SMC */
-	ret = ata_timing_compute(adev, adev->pio_mode, &timing, 1000, 0);
-	if (ret) {
-		dev_warn(ap->dev, "Failed to compute ATA timing %d, "
-			 "set PIO_0 timing\n", ret);
-		timing = *ata_timing_find_mode(XFER_PIO_0);
-	}
-	set_smc_timing(ap->dev, adev, info, &timing);
-}
-
-static unsigned int pata_at91_data_xfer_noirq(struct ata_device *dev,
-		unsigned char *buf, unsigned int buflen, int rw)
-{
-	struct at91_ide_info *info = dev->link->ap->host->private_data;
-	unsigned int consumed;
-	unsigned int mode;
-	unsigned long flags;
-
-	local_irq_save(flags);
-	regmap_fields_read(fields.mode, info->cs, &mode);
-
-	/* set 16bit mode before writing data */
-	regmap_fields_write(fields.mode, info->cs, (mode & ~AT91_SMC_DBW) |
-			    AT91_SMC_DBW_16);
-
-	consumed = ata_sff_data_xfer(dev, buf, buflen, rw);
-
-	/* restore 8bit mode after data is written */
-	regmap_fields_write(fields.mode, info->cs, (mode & ~AT91_SMC_DBW) |
-			    AT91_SMC_DBW_8);
-
-	local_irq_restore(flags);
-	return consumed;
-}
-
-static struct scsi_host_template pata_at91_sht = {
-	ATA_PIO_SHT(DRV_NAME),
-};
-
-static struct ata_port_operations pata_at91_port_ops = {
-	.inherits	= &ata_sff_port_ops,
-
-	.sff_data_xfer	= pata_at91_data_xfer_noirq,
-	.set_piomode	= pata_at91_set_piomode,
-	.cable_detect	= ata_cable_40wire,
-};
-
-static int at91sam9_smc_fields_init(struct device *dev)
-{
-	struct reg_field field = REG_FIELD(0, 0, 31);
-
-	field.id_size = 8;
-	field.id_offset = AT91SAM9_SMC_GENERIC_BLK_SZ;
-
-	field.reg = AT91SAM9_SMC_SETUP(AT91SAM9_SMC_GENERIC);
-	fields.setup = devm_regmap_field_alloc(dev, smc, field);
-	if (IS_ERR(fields.setup))
-		return PTR_ERR(fields.setup);
-
-	field.reg = AT91SAM9_SMC_PULSE(AT91SAM9_SMC_GENERIC);
-	fields.pulse = devm_regmap_field_alloc(dev, smc, field);
-	if (IS_ERR(fields.pulse))
-		return PTR_ERR(fields.pulse);
-
-	field.reg = AT91SAM9_SMC_CYCLE(AT91SAM9_SMC_GENERIC);
-	fields.cycle = devm_regmap_field_alloc(dev, smc, field);
-	if (IS_ERR(fields.cycle))
-		return PTR_ERR(fields.cycle);
-
-	field.reg = AT91SAM9_SMC_MODE(AT91SAM9_SMC_GENERIC);
-	fields.mode = devm_regmap_field_alloc(dev, smc, field);
-
-	return PTR_ERR_OR_ZERO(fields.mode);
-}
-
-static int pata_at91_probe(struct platform_device *pdev)
-{
-	struct at91_cf_data *board = dev_get_platdata(&pdev->dev);
-	struct device *dev = &pdev->dev;
-	struct at91_ide_info *info;
-	struct resource *mem_res;
-	struct ata_host *host;
-	struct ata_port *ap;
-
-	int irq_flags = 0;
-	int irq = 0;
-	int ret;
-
-	/*  get platform resources: IO/CTL memories and irq/rst pins */
-
-	if (pdev->num_resources != 1) {
-		dev_err(&pdev->dev, "invalid number of resources\n");
-		return -EINVAL;
-	}
-
-	mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
-	if (!mem_res) {
-		dev_err(dev, "failed to get mem resource\n");
-		return -EINVAL;
-	}
-
-	irq = board->irq_pin;
-
-	smc = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "atmel,smc");
-	if (IS_ERR(smc))
-		return PTR_ERR(smc);
-
-	ret = at91sam9_smc_fields_init(dev);
-	if (ret < 0)
-		return ret;
-
-	/* init ata host */
-
-	host = ata_host_alloc(dev, 1);
-
-	if (!host)
-		return -ENOMEM;
-
-	ap = host->ports[0];
-	ap->ops = &pata_at91_port_ops;
-	ap->flags |= ATA_FLAG_SLAVE_POSS;
-	ap->pio_mask = ATA_PIO4;
-
-	if (!gpio_is_valid(irq)) {
-		ap->flags |= ATA_FLAG_PIO_POLLING;
-		ata_port_desc(ap, "no IRQ, using PIO polling");
-	}
-
-	info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
-
-	if (!info) {
-		dev_err(dev, "failed to allocate memory for private data\n");
-		return -ENOMEM;
-	}
-
-	info->mck = clk_get(NULL, "mck");
-
-	if (IS_ERR(info->mck)) {
-		dev_err(dev, "failed to get access to mck clock\n");
-		return -ENODEV;
-	}
-
-	info->cs    = board->chipselect;
-	info->mode  = AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
-		AT91_SMC_EXNWMODE_READY | AT91_SMC_BAT_SELECT |
-		AT91_SMC_DBW_8 | AT91_SMC_TDF_(0);
-
-	info->ide_addr = devm_ioremap(dev,
-			mem_res->start + CF_IDE_OFFSET, CF_IDE_RES_SIZE);
-
-	if (!info->ide_addr) {
-		dev_err(dev, "failed to map IO base\n");
-		ret = -ENOMEM;
-		goto err_put;
-	}
-
-	info->alt_addr = devm_ioremap(dev,
-			mem_res->start + CF_ALT_IDE_OFFSET, CF_IDE_RES_SIZE);
-
-	if (!info->alt_addr) {
-		dev_err(dev, "failed to map CTL base\n");
-		ret = -ENOMEM;
-		goto err_put;
-	}
-
-	ap->ioaddr.cmd_addr = info->ide_addr;
-	ap->ioaddr.ctl_addr = info->alt_addr + 0x06;
-	ap->ioaddr.altstatus_addr = ap->ioaddr.ctl_addr;
-
-	ata_sff_std_ports(&ap->ioaddr);
-
-	ata_port_desc(ap, "mmio cmd 0x%llx ctl 0x%llx",
-			(unsigned long long)mem_res->start + CF_IDE_OFFSET,
-			(unsigned long long)mem_res->start + CF_ALT_IDE_OFFSET);
-
-	host->private_data = info;
-
-	ret = ata_host_activate(host, gpio_is_valid(irq) ? gpio_to_irq(irq) : 0,
-				gpio_is_valid(irq) ? ata_sff_interrupt : NULL,
-				irq_flags, &pata_at91_sht);
-	if (ret)
-		goto err_put;
-
-	return 0;
-
-err_put:
-	clk_put(info->mck);
-	return ret;
-}
-
-static int pata_at91_remove(struct platform_device *pdev)
-{
-	struct ata_host *host = platform_get_drvdata(pdev);
-	struct at91_ide_info *info;
-
-	if (!host)
-		return 0;
-	info = host->private_data;
-
-	ata_host_detach(host);
-
-	if (!info)
-		return 0;
-
-	clk_put(info->mck);
-
-	return 0;
-}
-
-static struct platform_driver pata_at91_driver = {
-	.probe		= pata_at91_probe,
-	.remove		= pata_at91_remove,
-	.driver		= {
-		.name		= DRV_NAME,
-	},
-};
-
-module_platform_driver(pata_at91_driver);
-
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Driver for CF in True IDE mode on AT91SAM9260 SoC");
-MODULE_AUTHOR("Matyukevich Sergey");
-MODULE_VERSION(DRV_VERSION);
-
-- 
2.7.4


^ permalink raw reply related

* Re: [PATCH 00/35] treewide trivial patches converting pr_warning to pr_warn
From: Rafael J. Wysocki @ 2017-02-17 12:27 UTC (permalink / raw)
  To: Joe Perches
  Cc: Alexander Shishkin, Karol Herbst, Pekka Paalanen,
	Richard Weinberger, Fabio Estevam, Linux Kernel Mailing List,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linuxppc-dev, tboot-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	oprofile-list-TtF/mJH4Jtrk1uMJSBkQmQ,
	sfi-devel-yLnuTTp1/kvcsJTPyzm5gB2eb7JE58TQ,
	xen-devel-GuqFBffKawtpuQazS67q72D2FQJk+8+b,
	ACPI Devel Maling List, drbd-dev-cunTk1MwBs8qoQakbn7OcQ,
	virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-crypto-u79uwXL29TY76Z2rM5mHXA,
	linux-ide-u79uwXL29TY76Z2rM5mHXA,
	gigaset307x-common-5NWGOfrQmneRv+LV9MX5uv+2+P5yyue3
In-Reply-To: <cover.1487314666.git.joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>

On Fri, Feb 17, 2017 at 8:11 AM, Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org> wrote:
> There are ~4300 uses of pr_warn and ~250 uses of the older
> pr_warning in the kernel source tree.
>
> Make the use of pr_warn consistent across all kernel files.
>
> This excludes all files in tools/ as there is a separate
> define pr_warning for that directory tree and pr_warn is
> not used in tools/.
>
> Done with 'sed s/\bpr_warning\b/pr_warn/' and some emacsing.

Sorry about asking if that has been asked already.

Wouldn't it be slightly less intrusive to simply redefined
pr_warning() as a synonym for pr_warn()?

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox