Attention is currently required from: Nico Huber, Angel Pons, Anastasia Klimchuk.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/55932 )
Change subject: [RFC] spi_master: Add shutdown function in spi_master struct
......................................................................
Patch Set 1:
(1 comment)
File programmer.h:
https://review.coreboot.org/c/flashrom/+/55932/comment/4eea0baf_cc4cdfb8
PS1, Line 359: shutdown
I am not sure how others feel but I would vote for this to be ideally called `deinit` and logically one level up in `struct programmer_entry`. We can get rid of register_shutdown() then.
--
To view, visit https://review.coreboot.org/c/flashrom/+/55932
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I2dc80dceca2f8204bcd0dad1f51753d7e79f1af5
Gerrit-Change-Number: 55932
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Comment-Date: Tue, 29 Jun 2021 09:05:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/55934
to look at the new patch set (#2).
Change subject: dediprog: Init-shutdown test for dediprog
......................................................................
dediprog: Init-shutdown test for dediprog
This patch adds mocks for libusb functions. To avoid dependency on
libusb.h all libusb-specific pointers are replaced with void*. Real
libusb handles/ctx/etc are not needed for tests, and real libusb
functions are never called in tests anyway. Cmocka wraps work with
this without complaints.
BUG=b:181803212
TEST=builds and ninja test
Change-Id: I38508dfb6d7c24d42522f22fcae0c5e410c5f7ea
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M tests/init_shutdown.c
M tests/io_mock.h
M tests/meson.build
M tests/tests.c
M tests/tests.h
5 files changed, 119 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/34/55934/2
--
To view, visit https://review.coreboot.org/c/flashrom/+/55934
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I38508dfb6d7c24d42522f22fcae0c5e410c5f7ea
Gerrit-Change-Number: 55934
Gerrit-PatchSet: 2
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/51761 )
Change subject: Accept shutdown function in register_master
......................................................................
Patch Set 3:
(1 comment)
Patchset:
PS3:
Returning back to this, finally! :)
This was a while ago, and half of that is already done (data), only shutdown function left.
I can rebase this, or another idea I wanted to discuss: CB:55932 which does not need to add one more argument to functions.
--
To view, visit https://review.coreboot.org/c/flashrom/+/51761
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I1704ddafc56e1393613a7ea077e40c36911cfac8
Gerrit-Change-Number: 51761
Gerrit-PatchSet: 3
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Nikolai Artemiev <nartemiev(a)google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-CC: Sam McNally <sammc(a)google.com>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Tue, 29 Jun 2021 06:09:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/55932 )
Change subject: [RFC] spi_master: Add shutdown function in spi_master struct
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
I was thinking about adding a shutdown function into one of the structs for a while (I mean into spi_master struct or programmer_entry). I wasn't sure which one of the structs is the right place for the shutdown function, and even more, why there are two structs describing the same thing? Especially now, when both structs are in the same file. Both in the same file, however they are separate and cannot share information between each other.
Programmer_entry has init function, so I was thinking of adding a shutdown there as well. But then I cannot access it from register_spi_master. Alternatively, I thought to add `register_shutdown(programmer->shutdown, data)` after flashrom.c#159, but data is not available on that level.
Data is needed for shutdown, but also data is something that is re-created for every new run. With that, maybe adding shutdown into spi_master is ok? Data is there already.
Another thing I don't know, why data is added into spi/par/opaque master struct (3 times), and not in registered_master struct. I added shutdown function where the data is.
--
To view, visit https://review.coreboot.org/c/flashrom/+/55932
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I2dc80dceca2f8204bcd0dad1f51753d7e79f1af5
Gerrit-Change-Number: 55932
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Tue, 29 Jun 2021 06:08:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/55932 )
Change subject: [RFC] spi_master: Add shutdown function in spi_master struct
......................................................................
[RFC] spi_master: Add shutdown function in spi_master struct
With this, register_spi_master can take care of register_shutdown
as well, and every spi master only needs to call register_spi_master
instead of calling both register_spi_master and register_shutdown.
This is alternative approach to CB:51761 which does not require
adding another argument to register_spi_master.
Testing: when I comment out free(data) in linux_spi_shutdown, test
fails with error
../linux_spi.c:235: note: block 0x55a4db276510 allocated here
ERROR: linux_spi_init_and_shutdown_test_success leaked 1 block(s)
Means, shutdown function is invoked.
Same for dummy: comment out free(data) in shutdown. It is also caught
in test
../dummyflasher.c:949: note: block 0x55e0727a6e40 allocated here
ERROR: dummy_init_and_shutdown_test_success leaked 1 block(s)
Means, shutdown function is invoked even for drivers with "old" API
(so, transition from old to new is not breaking anything).
Change-Id: I2dc80dceca2f8204bcd0dad1f51753d7e79f1af5
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M linux_spi.c
M programmer.h
M spi.c
3 files changed, 10 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/32/55932/1
diff --git a/linux_spi.c b/linux_spi.c
index 46779a0..16a83af 100644
--- a/linux_spi.c
+++ b/linux_spi.c
@@ -122,6 +122,7 @@
.read = linux_spi_read,
.write_256 = linux_spi_write_256,
.write_aai = default_spi_write_aai,
+ .shutdown = linux_spi_shutdown,
};
/* Read max buffer size from sysfs, or use page size as fallback. */
@@ -239,11 +240,8 @@
spi_data->fd = fd;
spi_data->max_kernel_buf_size = max_kernel_buf_size;
- if (register_shutdown(linux_spi_shutdown, spi_data)) {
- free(spi_data);
- goto init_err;
- }
- register_spi_master(&spi_master_linux, spi_data);
+ if (register_spi_master(&spi_master_linux, spi_data))
+ return 1; /* core does cleanup */
return 0;
init_err:
diff --git a/programmer.h b/programmer.h
index 95e2cda..ec55987 100644
--- a/programmer.h
+++ b/programmer.h
@@ -356,6 +356,7 @@
int (*read)(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
int (*write_256)(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
int (*write_aai)(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
+ int (*shutdown)(void *data);
void *data;
};
diff --git a/spi.c b/spi.c
index 4ac3914..99d036e 100644
--- a/spi.c
+++ b/spi.c
@@ -135,6 +135,12 @@
{
struct registered_master rmst = {0};
+ if (mst->shutdown)
+ if (register_shutdown(mst->shutdown, data)) {
+ mst->shutdown(data); /* cleanup */
+ return 1;
+ }
+
if (!mst->write_aai || !mst->write_256 || !mst->read || !mst->command ||
!mst->multicommand ||
((mst->command == default_spi_send_command) &&
--
To view, visit https://review.coreboot.org/c/flashrom/+/55932
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I2dc80dceca2f8204bcd0dad1f51753d7e79f1af5
Gerrit-Change-Number: 55932
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newchange
Attention is currently required from: Felix Singer.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/55866 )
Change subject: util: Name udev-rules file accordingly
......................................................................
Patch Set 4:
(2 comments)
Commit Message:
https://review.coreboot.org/c/flashrom/+/55866/comment/8f00046e_17d8f550
PS1, Line 9: Rename `z60_flashrom.rules` to `flashrom_udev.rules`.
> They have to read the file first anyway. Not every distro uses the same […]
As upstream systemd/udev uses ordering, I think that is the way to do it.
There is no reason specified, why all distributions already packaging flashrom have to adapt their packaging scripts to use the new name. The commit message does not say, why the new name is better, and I still do not see a reason.
[1]: https://github.com/systemd/systemd/tree/main/rules.d
Commit Message:
https://review.coreboot.org/c/flashrom/+/55866/comment/eb92b1c3_c0c12144
PS4, Line 7: accordingly
Just saw this now. This is missing something. “accordingly” to what?
--
To view, visit https://review.coreboot.org/c/flashrom/+/55866
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I1e7918d3121d89d3c388745e433a3a413eac0e21
Gerrit-Change-Number: 55866
Gerrit-PatchSet: 4
Gerrit-Owner: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Comment-Date: Mon, 28 Jun 2021 22:40:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Felix Singer <felixsinger(a)posteo.net>
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
Comment-In-Reply-To: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-MessageType: comment
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/55866 )
Change subject: util: Name udev-rules file accordingly
......................................................................
Patch Set 4:
(1 comment)
Commit Message:
https://review.coreboot.org/c/flashrom/+/55866/comment/73f04446_ae87372b
PS1, Line 9: Rename `z60_flashrom.rules` to `flashrom_udev.rules`.
> If a distro uses any ordering concept (some also don't), then package maintainers _have_ to deal wit […]
They have to read the file first anyway. Not every distro uses the same
group names for instance.
--
To view, visit https://review.coreboot.org/c/flashrom/+/55866
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I1e7918d3121d89d3c388745e433a3a413eac0e21
Gerrit-Change-Number: 55866
Gerrit-PatchSet: 4
Gerrit-Owner: Felix Singer <felixsinger(a)posteo.net>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Comment-Date: Mon, 28 Jun 2021 16:48:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Felix Singer <felixsinger(a)posteo.net>
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
Comment-In-Reply-To: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-MessageType: comment