Re: LDD3 vs Essential Linux Device Drivers

2020-04-30 Thread Greg KH
On Fri, May 01, 2020 at 07:58:11AM +0200, Mohamed Dawod wrote:
> Hi,
> 
> I would like to start learning about Linux kernel and device drivers
> development.
> Should I have to start with LDD3 as a lot of people advice ? or can I start
> with the Essential Linux Device Drivers by Sreekrishnan Venkateswaran.
> I know that the second book may be more advanced but I feel that it's more
> more practical and easier to be understood.

Why not get both and see which one works for you?

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


LDD3 vs Essential Linux Device Drivers

2020-04-30 Thread Mohamed Dawod
Hi,

I would like to start learning about Linux kernel and device drivers
development.
Should I have to start with LDD3 as a lot of people advice ? or can I start
with the Essential Linux Device Drivers by Sreekrishnan Venkateswaran.
I know that the second book may be more advanced but I feel that it's more
more practical and easier to be understood.


Thanks,
-- 
Mohamed
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: how to perform i2c transaction with disabled irq?

2020-04-30 Thread Tomek The Messenger
They are afraid that some peripheral device will report interrupt and after
board reset the peripheral device will be in some transient state if
handling of interrupt from peripheral device will be somewhere in the
middle interrupted by board reset. However in this case this is probably
uboot task to initialize peripheral devices from the beginning, switch them
and release from reset. Or another way is to shutdown peripheral devices
before reset, disable interrupts in their internal registers - at least
when /sbin/reboot is executed we see that before reset shutdown procedure
is running.

On Thu, Apr 30, 2020 at 1:20 PM Greg KH  wrote:

> On Thu, Apr 30, 2020 at 01:11:06PM +0200, Tomek The Messenger wrote:
> > Hi
> > If I don't have disabled irqs I can use API i2c_smbus_write_byte in order
> > to perform i2c transaction.
> > But how to make i2c transaction if I have disabled irq? Is any built-in
> > function which lets such operation, where there is some polling
> implemented?
> > The background is that I do i2c transaction in restart handler (some i2c
> > transaction to hot swap controller) in order to reset board.  And linux
> > before entering restart handler list disable interrupts. There is a
> > function to enable back interrupts but in company in which I am working
> > engineers reviewed it and said "it is not allowed, restart must be
> > performed when interrupts are disabled".
>
> Ask the engineers how you are supposed to use an interrupt driven device
> with interrupts disabled.
>
> good luck!
>
> greg k-h
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Call flush_scheduled_work in the context of a work routine

2020-04-30 Thread Bogdan Bogush
The comment to flush_scheduled_work states that calling this function in
the context of a work routine will lead to deadlock. I think it means
following scenario:

static void
handler(struct work_struct *work)
{
flush_scheduled_work();
}
static DECLARE_WORK(work, handler);
schedule_work(&work);


If this is true for system workqueue (system_wq) is it also applied to
custom workqueue? I want to wait for completion of the workqueues in
another workqueue. For example:

static void
handler(struct work_struct *work)
{
struct work_data * data = (struct work_data *)work;
flush_scheduled_work();
kfree(data);
}
  wq = create_workqueue("wq_test");
  data = kmalloc(sizeof(struct work_data), GFP_KERNEL);
  INIT_WORK(&data->work, handler);
  queue_work(wq, &data->work);
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: how to perform i2c transaction with disabled irq?

2020-04-30 Thread Greg KH
On Thu, Apr 30, 2020 at 01:11:06PM +0200, Tomek The Messenger wrote:
> Hi
> If I don't have disabled irqs I can use API i2c_smbus_write_byte in order
> to perform i2c transaction.
> But how to make i2c transaction if I have disabled irq? Is any built-in
> function which lets such operation, where there is some polling implemented?
> The background is that I do i2c transaction in restart handler (some i2c
> transaction to hot swap controller) in order to reset board.  And linux
> before entering restart handler list disable interrupts. There is a
> function to enable back interrupts but in company in which I am working
> engineers reviewed it and said "it is not allowed, restart must be
> performed when interrupts are disabled".

Ask the engineers how you are supposed to use an interrupt driven device
with interrupts disabled.

good luck!

greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


how to perform i2c transaction with disabled irq?

2020-04-30 Thread Tomek The Messenger
Hi
If I don't have disabled irqs I can use API i2c_smbus_write_byte in order
to perform i2c transaction.
But how to make i2c transaction if I have disabled irq? Is any built-in
function which lets such operation, where there is some polling implemented?
The background is that I do i2c transaction in restart handler (some i2c
transaction to hot swap controller) in order to reset board.  And linux
before entering restart handler list disable interrupts. There is a
function to enable back interrupts but in company in which I am working
engineers reviewed it and said "it is not allowed, restart must be
performed when interrupts are disabled".
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies