The core specification v4.0 vol 3 part C section 3.2.2.3 "Bluetooth Device Name -- Representation" states that the device name can be up to 248 bytes. I've confirmed that sd_ble_gap_device_name_set
rejects long device names, consistent with BLE_GAP_DEVNAME_MAX_LEN being 31 in the S110 v 7.1.0 soft device.
We may be able to make do with 31 chars but there are cases (especially for non-European languages using UTF-8 encoding) where that may be a significant limitation. Does Bluetooth allow an implementation to reject the full length? (Yes I know longer ones won't fit in advertising/reponse packets but you can retrieve UUID 2a00 directly to get the full name.)