oceanic: avoid unnecessary difference with Jef's upstream version
We ended up merging Janic McLaughlin's fix for dive truncation issues
into the subsurface branch, and then Jef ended up taking it too, but
making some changes while at it.
See commit 17ff3e066769 ("Oceanic: fix up dive truncation issues, update
memory layout") vs commit 04c367fd0645 ("Oceanic: fix up dive truncation
issues").
The two versions end up doing the same thing, this takes Jef's version
to minimize differences to upstream.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
bec9ca9e3c
commit
b3b4eb91a2
@ -521,14 +521,13 @@ oceanic_common_device_profile (dc_device_t *abstract, dc_event_progress_t *progr
|
||||
|
||||
// Remove padding from the profile.
|
||||
if (layout->highmem) {
|
||||
unsigned char *profile = profiles + offset;
|
||||
// profile+12 and the bottom 4 bits of profile+13 and the top 3 bits of profile+13
|
||||
// is the number of pages of profile data until the start of the footer
|
||||
// (not including the prepended logbook entry).
|
||||
unsigned int high_part = array_uint16_le (profile + 12) & 0xE000;
|
||||
unsigned int low_part = array_uint16_le (profile + 12) & 0x0FFF;
|
||||
unsigned int npages = ((high_part >> 1) | low_part) + 1;
|
||||
// INFO (abstract->context, "profile npages: 0x%X (%d)", npages, npages);
|
||||
// The logbook entry contains the total number of pages containing
|
||||
// profile data, excluding the footer page. Limit the profile size
|
||||
// to this size.
|
||||
unsigned int value = array_uint16_le (profiles + offset + 12);
|
||||
unsigned int value_hi = value & 0xE000;
|
||||
unsigned int value_lo = value & 0x0FFF;
|
||||
unsigned int npages = ((value_hi >> 1) | value_lo) + 1;
|
||||
unsigned int length = npages * PAGESIZE;
|
||||
if (rb_entry_size > length) {
|
||||
rb_entry_size = length;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user